[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Question about Lua performance (locals vs globals)
- From: "Duncan Cross" <duncan.cross@...>
- Date: Thu, 7 Aug 2008 12:53:51 +0100
On Wed, Aug 6, 2008 at 1:37 AM, David Given <dg@cowlark.com> wrote:
> Lua globals aren't really
> variables at all; they're simply syntactic sugar for doing table
> accesses on _G.
> local _G = {} -- actually defined internally
There's some potential for confusion here, I think, for people new to
Lua - it could be read that "_G" is a standard ever-present keyword
that can always be relied on to refer to the globals table, when it is
really just a convenient addition to the "standard" globals table. If
"_G" happens not to be an entry in your Lua universe then it is
suddenly no longer syntactic sugar - there's no other way to refer to
globals than to refer to them directly.