Rick Posted January 16, 2010 Share Posted January 16, 2010 I often require to do some code in a Thingoid just once on startup of game mode. Until now I just made a bool variable in a Thingoid and checked it in the Update() method and that's how I did my init code. I've decided to come up with a better way now. Inside your main lua file right before the main loop do this: for k,v in pairs(objecttable) do if v.Initialize ~= nil then v:Initialize() end end Then in your Thingoid you can, but don't have to, define: function object:Initialize() end You can do this with any kind of function. Enjoy! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.