Having one lua_State per script rather than per entity would be huge memory savings!<div><br></div><div>It doesn&#39;t seem like that&#39;d be much of a waste at that point. The waste is loading the same scripts multiple times.<br>
<br><div class="gmail_quote">On Sat, Jul 3, 2010 at 8:24 AM, Andrew Church <span dir="ltr">&lt;<a href="mailto:achurch%2Baquaria@achurch.org">achurch+aquaria@achurch.org</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div class="im">&gt;&gt;My friend&#39;s table of local variables seems a bit simpler/straightforward<br>
&gt;&gt;while still being pretty clean?<br>
<br>
</div>So I was giving this variable table idea some thought, and a potential<br>
problem occurred to me:  How do you differentiate between functions from<br>
different scripts?  I may just be misunderstanding your original<br>
suggestion, but if we use a single lua_State for everything, then the<br>
scripts are all going to have name collisions on the common functions like<br>
init(), update(), and so on since those get registered in the global<br>
namespace.<br>
<br>
I guess if you set up one lua_State for each script file with a separate<br>
variable table for each instance of the script, you could avoid the<br>
collisions, but then we&#39;re wasting memory on multiple states again...<br>
<div><div></div><div class="h5"><br>
  --Andrew Church<br>
    <a href="mailto:achurch@achurch.org">achurch@achurch.org</a><br>
    <a href="http://achurch.org/" target="_blank">http://achurch.org/</a><br>
_______________________________________________<br>
aquaria mailing list<br>
<a href="mailto:aquaria@icculus.org">aquaria@icculus.org</a><br>
<a href="http://icculus.org/mailman/listinfo/aquaria" target="_blank">http://icculus.org/mailman/listinfo/aquaria</a><br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br>Alec Holowka<br><a href="http://www.infiniteammo.ca">www.infiniteammo.ca</a><br><a href="http://www.bit-blot.com">www.bit-blot.com</a><br>
</div>