lua-users home
lua-l archive

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

On Fri, Jan 25, 2013 at 12:59 AM, Finn Wilcox <> wrote:
But still, I agree with the "definitely didn't expect this!" remark.
Shouldn't f2() return nil rather than _ENV?

This behaviour, along with the reason for it, is explicitly documented in 5.2 manual entry for load:
    If the resulting function has upvalues, the first upvalue is set to the value of the global environment or to env, if that parameter is given. When loading main chunks, the first upvalue will be the _ENV variable (see §2.2).