[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: callstack recursive environment
- From: Steve Litt <slitt@...>
- Date: Wed, 28 Mar 2012 19:59:44 -0400
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