Code: Select all
local loaded = false
function on_loaded(e)
--- intialize what u want
--- game object accessible
end
script.on_nth_tick(1,
function(e)
if loaded then
script.on_nth_tick(1, nil) -- should use a mutiple handlers mechanism, here just demo
else
on_loaded(e)
loaded = true
end
end
)
Could we guarantee this is the first event triggered when game loaded ?