lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


> > _ENV is a real variable in all senses. We though about using _G, but
> > that would create a needless incompatibility for code that manipulates
> > _G.  Apart from that, _G is as good a name as any other.
> 
> It seems a pity to have two names for essentially the same thing.

They're not at all the same thing: changing _G has no effect, whereas
changing _ENV does. _G is just the default value for _ENV in chunks
loaded with load. More precisely, the default value is the table of
globals, which happens to be the starting value of _G.