[aquaria] Updating 3rd-party mods to the lua-changes branch syntax
Andrew Church
achurch+aquaria at achurch.org
Tue Jan 18 19:51:24 EST 2011
>Is there consolidated documentation anywhere on the changes required on the
>lua scripts to run with your devel branch?
All the information you'll need should be in Aquaria/ScriptInterface.cpp,
but the short version is:
- Add a line saying "v = getVars()" at the top of _every_ script.
- Prefix _every_ global variable reference with "v.". (It's also okay to
declare variables local if they're only used within a single block.
The important thing is to not use global variables.)
- Declare _every_ non-interface function as local. (Interface functions
are init(), update(), etc.; see interfaceFunctions[] for a full list.)
- _Never_ make function calls (math.random(), etc.) at file scope. Since
Lua tables are actually references, this also means you can't declare
tables at file scope -- initialize them to nil and assign a table value
in init() instead.
--Andrew Church
achurch at achurch.org
http://achurch.org/
More information about the aquaria
mailing list