[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: What happens when you try to serialize a closure
- From: Peter Cawley <lua@...>
- Date: Fri, 25 Jan 2013 01:05:30 +0000
On Fri, Jan 25, 2013 at 12:59 AM, Finn Wilcox <email@example.com> 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).