Tom and ewing, Thanks for the clarifications. I guess my impression that we were supposed to avoid globals came from various areas of this site, such as this quote from Beebe’s blog post http://blog.anscamobile.com/2011/09/a-better-approach-to-external-modules/
“…Since the general rule of thumb in Lua is to try your best to avoid using globals altogether …”
And this, from your docs http://developer.anscamobile.com/content/performance-and-optimization
“…Avoid global variables. Period. In Lua, you will sacrifice performance if you use global variables. When in doubt, precede your variable declarations with local…”
But, as you say, avoiding globals at all costs can get ridiculous really fast. I fact, I don’t do anything special to avoid them, still use the old module(…, package.seeall) all over the place and haven’t had noticeable performance issues. I guess this is an area open to debate, rather than hard and fast rules, even among the Anscafolk
[import]uid: 9422 topic_id: 21532 reply_id: 86227[/import]