[aquaria] Patch to run Lua scripts as threads

Alec Holowka zaphire at gmail.com
Tue Jun 29 04:42:02 EDT 2010

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

On Tue, Jun 29, 2010 at 12:26 PM, Andrew Church
<achurch+aquaria at achurch.org<achurch%2Baquaria at achurch.org>
> wrote:

> >Well even if it's local to the script (not sure that the entire script is
> >considered a block or not), that doesn't solve the problem of creating
> >multiple instances of one loaded script. (which is what we want, right?)
> Hmm, good point.  If you use loadfile() to open the script, it looks
> like you get a Lua function back (an anonymous function containing the
> script as a block), so each invocation of that function would create new
> local variables.  I was thinking you could use that function as the main
> function of a Lua thread for each entity, but then I guess you'd need to
> add some sort of "while ~dead do waitForEvent() end" loop to every
> script and change the entire event processing system to send events to
> the script event loop rather than calling Lua functions directly, which
> sounds like a pain.  I guess you could load the file and lua_dump() it
> into a memory buffer, which would then be faster to load for subsequent
> entities because it wouldn't have to be recompiled again -- but that's
> probably a worse hack than what I have right now.
> I dunno, maybe I'm trying to make the code prettier than it needs to be? (:
>  --Andrew Church
>    achurch at achurch.org
>    http://achurch.org/
> _______________________________________________
> aquaria mailing list
> aquaria at icculus.org
> http://icculus.org/mailman/listinfo/aquaria

Alec Holowka
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://icculus.org/pipermail/aquaria/attachments/20100629/589b2e22/attachment.htm>

More information about the aquaria mailing list