I’ve been using the following modularization approach in the recent blog article:
gamefunctions.lua
function doSomething()
-- something
end
level.lua
local myFunction = gamefunctions.doSomething()
When using this approach, I can’t access any variables in one file from the other file unless it’s global (with _G.). Same goes for no -variables like groups. LUA seems to treat them as two completely different files.
For this reason, I am using a lot of global variables to communicate between the two files. Is this normal?
Also, if I use global variables, as long as I clean them (remove and nil them out) does it make any difference from using local vars?
[import]uid: 39031 topic_id: 17529 reply_id: 317529[/import]

[import]uid: 52491 topic_id: 17529 reply_id: 66616[/import]