[aquaria] Patch to run Lua scripts as threads

Andrew Church achurch+aquaria at achurch.org
Sat Jul 3 13:24:03 EDT 2010


>>My friend's table of local variables seems a bit simpler/straightforward
>>while still being pretty clean?

So I was giving this variable table idea some thought, and a potential
problem occurred to me:  How do you differentiate between functions from
different scripts?  I may just be misunderstanding your original
suggestion, but if we use a single lua_State for everything, then the
scripts are all going to have name collisions on the common functions like
init(), update(), and so on since those get registered in the global
namespace.

I guess if you set up one lua_State for each script file with a separate
variable table for each instance of the script, you could avoid the
collisions, but then we're wasting memory on multiple states again...

  --Andrew Church
    achurch at achurch.org
    http://achurch.org/


More information about the aquaria mailing list