[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: What happens when you try to serialize a closure
- From: Luiz Henrique de Figueiredo <lhf@...>
- Date: Fri, 25 Jan 2013 08:00:07 -0200
> Running the attached script you'll notice that _ENV is not the first
> upvalue. Should the manual be amended?
The manual is clear: "When loading main chunks, the first upvalue will
be the _ENV variable". The key word here is "main". So, this holds only
for the function that represents a chunk, not the functions that it
defines. Try luac -l -l on your program and get:
main <upvals.lua:0,0> (33 instructions at 0x1019016f0)
upvalues (1) for 0x1019016f0:
0 _ENV 1 0
function <upvals.lua:3,6> (7 instructions at 0x101901930)
upvalues (2) for 0x101901930:
0 somelocal 1 0
1 _ENV 0 0