[aquaria] Patch to run Lua scripts as threads

Alec Holowka zaphire at gmail.com
Sat Jul 3 14:26:48 EDT 2010


Having one lua_State per script rather than per entity would be huge memory
savings!

It doesn't seem like that'd be much of a waste at that point. The waste is
loading the same scripts multiple times.

On Sat, Jul 3, 2010 at 8:24 AM, Andrew Church
<achurch+aquaria at achurch.org<achurch%2Baquaria at achurch.org>
> wrote:

> >>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/
> _______________________________________________
> aquaria mailing list
> aquaria at icculus.org
> http://icculus.org/mailman/listinfo/aquaria
>



-- 
Alec Holowka
www.infiniteammo.ca
www.bit-blot.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://icculus.org/pipermail/aquaria/attachments/20100703/87148a55/attachment.htm>


More information about the aquaria mailing list