[aquaria] [patch] Script interface fixes + cleanup

False.Genesis false.genesis at googlemail.com
Wed Sep 14 22:46:06 EDT 2011

Hi all, made another patch that addresses some issues mostly in the 
scripting interface.
Got myself into modding lately, and already found enough things that 
bothered me.
The patch file contains a description of all changes; had to edit it by 
hand a bit, hope it does still apply. Made against current icculus repo.

Sorry that the patch is so large and changes many things at once, but i 
got carried away by cleaning up that convoluted code.

Actually, sometimes i am puzzled a bit that the engine works so well. I 
must have hit a lot of corner cases, typos, and especially the functions 
that were missing NULL pointer checks when writing scripts, which the 
game did not like that at all.
Anyways, with these changes, #undef AQUARIA_FULL, and all script 
warnings except throwLuaErrors turned on, writing scripts is now 
actually fun and a lot less time consuming :)

Btw, does it make any sense that all functions that do not return 
anything actually pass an explicit luaReturnNum(0) back to Lua?
Imho, replacing these with a simple "return 0;" to indicate that the 
function pushed nothing on the Lua stack, would be faster and simpler 
(and make it return nil implicitly).

There are also many cases where implicit int<->float conversion happens, 
although Lua has specialized functions for this - the doc says they 
might be faster if using explicit optimized assembly (which they do).
Sometimes the conversion happens back and forth, which is also not 
necessary. I think i fixed the cases where this was an issue; but not 
sure about the rest - is possible that it loses enough precision to mess 
up at some point?

I'd be willing to address these 2 issues, but i want to know opinions first.

+ The sun form crash bug I mentioned earlier is also present in the 
icculus code, stumbled upon the same crashes while testing.

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: scriptcleanup.patch
URL: <http://icculus.org/pipermail/aquaria/attachments/20110915/3d580d61/attachment-0001.diff>

More information about the aquaria mailing list