lua-users home
lua-l archive

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



On Aug 11, 2014, at 11:34 AM, Roberto Ierusalimschy <roberto@inf.puc-rio.br> wrote:

[...]

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?

The 5.2 ref manual (section 2.2) states “When Lua compiles a chunk it initializes the value of its _ENV upvalue…”. When I was initially studying Lua this did confuse me until I realized that it really means “When Lua LOADS a chunk…” (which of course might also entail compiling it unless a pre-compiled chunk was supplied). When I first read this is seemed to suggest that the compiler was emitting some magic bytecode that, when later loaded, would wire-up _ENV to the global environment.

—Tim