lua-users home
lua-l archive

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


> [...]
> 
> Is this the correct interpretation? If so, the manual could definitely
> use some clarifications here, ideally relying on familiar terminology
> that's not so ambiguous.

Your interpretation until this point was quite correct (and it seems
to have been derived from the manual). What is so ambiguous in that
terminology?


> This is the other part that confused me:
> 
>    _ENV is the "global scope"

Where did you read this? In the manual?


> What does that mean? In the PiL^3 book, it says something similar, but
> instead of _ENV = _G, it says _ENV = <global environment> which made
> me think it was doing a special per-entry copy into a new table or
> something.

No assignment in Lua creates a new table. Why this one would be different?

What it does is equivalent to "_ENV = _G", but it does not use _G
itself (remember that Lua never uses _G); instead, it uses the private
reference to the global table kept in the registry, so the notation
<global environment>.

-- Roberto