lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


hi ppl,
We are using LUA for Game scripting in our engine. In the scripts we make heavy (about 50 - 70, every frame) use of string comparisons. The scripts are taking quite a bit of the processor, so we wanted to optimize them. My fellow developer suggested that maybe we should change all the string comparisons to number (integer) comparisons. But I had read on this list that in lua string comparisons are very cheap, since actually it is just a pointer comparison.
Just wanted to confirm this. In the scripts we make comparisons such as this:
 
if BOTA_STATE == "ATTACK" then
    --blah blah
elseif BOTA_STATE == ""RUN" then
    --blah blah
etc etc.....
 
I am not very keen on changing the string comparison to integer comparisons since that will mean a lot of work for me that I do not have time for atleast for now. so what do you ppl suggest, should I change or if the performance hit of string comparisons is not that much I could just leave it for another time ?
 
Thanking in advance,
Sohyl.


Do you Yahoo!?
Yahoo! Small Business - Try our new resources site!