[aquaria] [PATCH] Backward compatibility for scripts

Andrew Church achurch+aquaria at achurch.org
Wed May 4 09:10:29 EDT 2011

>> - The "v = getVars()" boilerplate line at the top of each script has
>>    been changed to read "if not v then v = {} end".
>Can we just change this so when the lua state is originally created, we 
>set the global 'v' to an empty table in C code, so scripts don't need to 
>do this at all?

The point of the new line is so that these scripts work with both the
current engine (which already does that) and the commercial one (which
obviously we can't change).  Technically the line isn't required for the
scripts to work with the new engine, but my intent is to provide a
template for mod writers who probably want to remain compatible with
both versions.

>(also, maybe we change getVars() to be a C function that just returns 
>the global 'v', so we don't have to change scripts regardless of where 
>they landed?)

getVars() is something I added as part of the single Lua state change,
not something that was present from the beginning; I only took it out as
a matter of cleanliness.  We could in theory leave it in, but since the
amount of code written for the Aquaria script engine is limited (and
hopefully the amount already using getVars() is even smaller), I'd
rather take the cleaner approach, even if it means more work for me in
the short term.

  --Andrew Church
    achurch at achurch.org

More information about the aquaria mailing list