Modules are very useful, however, accessing the variables declared within modules becomes quite verbose, for example, this is in a Module:
local Module = {a = 1, b = 2, c = 3}
local d = 4
local e = 5
local f = 6
return Module
… I have to reference variables a, b, c as print(Module.a, Module.b, Module.c).
At the same time, I cannot access local variables d, e, f…
It becomes very wordy to always put Module. in front of each variable…
Any way to make this easier?
Kaid3n22
(Kaiden)
2
Sadly, as far as I know, there is no way to do what you are talking about unless you return those too.
local Module = {a = 1, b = 2, c = 3}
local d = 4
local e = 5
local f = 6
return Module, d, e, f
Other than that, to make it less wordy, you could just change the table name to something easy
local t = {a = 1, b = 2, c = 3}
local t.d = 4
local t.e = 5
local t.f = 6
return t
2 Likes
Won’t work, will show error: Module code did not return exactly one value
1 Like
Kaid3n22
(Kaiden)
4
oh, didn’t know modules did that until now, so no, it is impossible without putting it in the table.
1 Like