lua-users home
lua-l archive

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

> On Thu, Feb 25, 2010 at 4:13 PM, steve donovan
> <> wrote:
> > Using _G specially refers to the global namespace; _ENV may or may not.
> Using _G refers to _ENV._G, hence if you've changed _ENV, then _G
> refers to the global namespace if and only if you added a _G field to
> the custom _ENV pointing back to the original value of _ENV. If you
> haven't changed _ENV, then _G and _ENV are the same thing anyway.

Keep in mind that it is common to have the new environment inheriting
from the original one (e.g., the option 'seeall' in 'module'). In those
cases, _G is automatically accessible in the new environment, and
it is different from _ENV.

-- Roberto