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