With a load of LUA script and stuff, my application started lagging. This is obviously because I made it run the whole script constantly in one function. Is there any way to do this otherwise so it doesn't lag?
Printable View
With a load of LUA script and stuff, my application started lagging. This is obviously because I made it run the whole script constantly in one function. Is there any way to do this otherwise so it doesn't lag?
I think you'd have to split it into multiple functions.
Try running the script once, and the script just containing function declarations. The functions will then be in Lua's memory as "compiled" bytecode, and if you call the functions when you need them it will be faster running them than running the file every loop.
Err, could you make a small example of that?
hey, i take this opportunity to ask you guys:
what kind of things do you do with Lua, I never quite understood what it was adding in terms of functionnality?
thanks
You can run LUA codes ok
jpcr : LUA is an advanced scripting language. Instead of using the event editor, you could program complex functions in LUA, that would otherwise require tons of events.
Also, you can enable those who play your game to create custom creatures and enemies by writing their own LUA scripts, rather than having to give them the MMF2 source. It's great in combination with a level editor.
ok great but any nice examples out there?
http://lua-users.org/wiki/ JESUSQuote:
Originally Posted by jpcr
Now back to my question
Here's my code:
http://www.sendspace.com/file/jjvqet
The part with the "function always()" is the part that's important.