Basically, I use functions from modulescript1 in modulescript2, and use functions from from modulescript2 in modulescript1.
My issue is fixed if:
I can pull out variables from a localscript and use them in my modulescript, my issue is fixed
if I can somehow use functions from modulescript1, in modulescript2, and use functions from from modulescript2, in modulescript1
your two modules require each other on require, just require it right before using it.
ex:
local module = {}
local otherModule = require(...) -- this module requires this module on require, which makes it recurse
module.doSomething = function()
otherModule.doOther()
end
do this instead
local module = {}
module.doSomething = function()
local otherModule = require(...) -- this module requires this module on require, which makes it recurse
otherModule.doOther()
end
But, wouldn’t that create some delays and potentially some lag? I’d like to “load in” the modules before the function is run, if that’s the case :D
local module = {}
local secondModule
module.init = function()
secondModule = require(...)
end
module.doSomething = function()
-- can check if secondModule is not nil
secondModule.doSomething()
end
--// main
local module = require(firstModule)
module.init()
module.doSomething()