The question
I need to use two module scripts that has a third as its parent, For efficiency I would like to just have to require the top level module script instead of having to individually add each module script into a separate variable.
So is it possible to merge the two child module scripts in the parent? For efficiency I do not want to make another copy.
Example only (not tested)
module script A:-
local f = {}
function f.a()
print('a1')
end
function f.b()
print('a2')
end
return f
module script b:-
local f = {}
function f.c()
print('b1')
end
function f.d()
print('b2')
end
return f
Parent module script:-
local mod1 = require(script.a)
local mod2 = require(script.b)
-- I am not looking to create another variable e.g.
local tmp = {}
for I, v in pairs(mod1) do
--add to tmp
end
for I, v in pairs(mod2) do
--add to tmp
end
return tmp --- I do not want to make a copy as this is inefficient
-- now how do I return both module script as one variable
return mod1+mod2 -- example
I hope that I have managed to explain this well, pls comment if you need any more info.

1 comment
Eww.