[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Recipe: setfenv with Lua 5.2.0 work3
- From: Peter Cawley <lua@...>
- Date: Thu, 20 May 2010 17:41:10 +0100
On Thu, May 20, 2010 at 5:38 PM, Enrico Colombini <erix@erix.it> wrote:
> do local _ENV = e; f() end
That doesn't execute f() in the context of e (nor did the old "in e do
f() end"). _ENV is a local/upvalue like any other, hence declaring a
new local called _ENV will not affect any functions declared outside
the scope of the local. I suspect you want to use debug.setupvalue
instead.