Hello, I’m wondering if there would be any way to retrieve the script that is currently requiring a module script from within the module script so it can send information that only that specific script needs?
Any and all help is appreciated!
Hello, I’m wondering if there would be any way to retrieve the script that is currently requiring a module script from within the module script so it can send information that only that specific script needs?
Any and all help is appreciated!
Currently there isn’t a built-in way to do this, but an alternative would be to return a function in the module script, and then within the script requiring it you could do
local module = require(path.to.module)(script)
From there you could return something INSIDE that function that the script needs
Example module code:
local module = {}
return function(scriptRequiring)
local toReturn = module
-- do stuff
return toReturn
end
Thanks, this worked! Didn’t even think of doing it this way!