[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: from: Lua Module Function Critiqued
- From: Luiz Henrique de Figueiredo <lhf@...>
- Date: Tue, 8 Oct 2013 22:23:43 -0300
> In lua 5.2, my understanding is that _ENV is always the first upvalue. Is
> this not true?
It is true for main chunks but not for individual functions.
Consider the program below and run luac -l -l -p on it:
local x
function f() return x+y end
function g() return x end
Then _ENV is the first (and only) upvalue of the main function,
but it is the second of f and is not an upvalue of g.