[aquaria] Patch to run Lua scripts as threads

Alec Holowka zaphire at gmail.com
Sun Jul 4 22:10:19 EDT 2010

Yeah, that really doesn't sound like it's worth it. :P

On Mon, Jul 5, 2010 at 5:38 AM, Andrew Church
<achurch+aquaria at achurch.org<achurch%2Baquaria at achurch.org>
> wrote:

> >Slightly off topic, but I'm guessing one way to get everything onto one
> >state would be to append the name of the script to every common function
> >call.
> >
> >So like nautilusUpdate() or nautilus_update() instead of update()
> >
> >This seems like it might be a major pain in the ass though?
> Yeah, I was thinking about that too but it raises all sorts of problems,
> like having to know the script name to call it from C code, having to
> rename all the functions if you rename the file, dealing with filename
> case issues (since Lua identifiers are case-sensitive)...  Not really
> worth it IMHO.
> Another thing I was thinking of was setting up something like an
> interface table, which you could return at the bottom of each source
> file -- at least I assume you can do that because loadfile() treats the
> entire source file as a function.  So you'd do like
> local interface = {}
> function interface.init() ... end
> function interface.update() ... end
> return interface
> Then the C code would save that table, and when it needed to call a
> function it would look up the function in there instead of in the global
> table.  That would be less invasive, I think; the problem is that it
> breaks on dofile() includes -- you can't declare helper functions
> globally because of name collisions, and you couldn't make them local
> because then they'd be local to the include file instead of the calling
> script.  You could maybe treat include files like modules and do
> 'local doorcommon = dofile("doorcommon")' or some such, then change
> all the calls like commonInit() to doorcommon.commonInit(), but again,
> I'm not sure it'd be worth going that far.
>  --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/20100704/335b5eb6/attachment.htm>

More information about the aquaria mailing list