From:
Steve Litt <slitt@troubleshooters.com>
To: lua-l@lists.lua.org
Sent: Wednesday, March 28, 2012 5:59 PM
Subject: Re: callstack recursive environment
On Wed, 28 Mar 2012 18:00:50 -0400
David Favro <
lua@meta-dynamic.com> wrote:
> On 03/28/2012 02:46 PM, Steve Litt wrote:
>
> > First, a disclaimer. I don't know how global variables work in any
> > language because I never use them,
>
> Really? By "use" do you mean "set"? Because Lua is pretty hard to
> use if you never access type, require, pairs, table, string, io,
> etc. Or do you not consider them "global" because they are in the
> "environment"?
>
The latter. I always considered type, require, pairs, table, string, io
part of the language or Lua libraries.
What I mean is I don't do this:
mycount = 3
function inccount()
mycount = mycount + 1
end
inccount()
Instead I typically do something like
this:
local mycount = 3
function incc(number)
return number + 1
end
mycount = incc(mycount)
Also, I create and call functions globally. In most languages they're
not data, and I've had few if any problems from using functions
globally instead of passing them as arguments.
SteveT