[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Recipe: setfenv with Lua 5.2.0 work3
- From: steve donovan <steve.j.donovan@...>
- Date: Thu, 20 May 2010 18:05:18 +0200
On Thu, May 20, 2010 at 4:48 PM, François Perrad
<francois.perrad@gadz.org> wrote:
> if debug.setupvalue(debug.getinfo(level, 'f').func, 1, M) ~= '_ENV' then
> setfenv(level, M) -- Lua 5.1
> end
You can't keep a good concept down ;)
I also worry about the magic-ness of 1 here, as well as the magic-ness of _ENV.
It's a question of how much sugar a person needs, but
in t do x = 10; y = 20 end
seems easier to read than
do local _ENV = t; x = 10; y = 20 end
But it can always be a macro ;)
steve d.