Normally I put all logic and initialisation of objects INSIDE functions. Put all that stuff inside an init() function at the top. But don’t call init() until the very last line of code. That way everything is always forwarded. Make sense?
Basically make the last line execute the very first instruction.
i.e
[lua]function init()
doSomething()
doSomethingElse()
end
local function doSomething()
print ( “doSomething” )
end
local function doSomethingElse()
print ( “doSomethingElse” )
end
init()[/lua]