[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Lua registry, environment, and threads.
- From: Wim Couwenberg <wim.couwenberg@...>
- Date: Fri, 8 Jan 2010 07:04:15 +0100
> Lua 5.2 will have "lexical environments", a kind of lexical setfenv.
> The construction "in t do command end" will execute <command> with
> all global variables being resolved in <t>.
I didn't closely follow this thread so maybe it was answered already,
but did you consider using an upvalue for the environment?
in <identifier> do ... end
This lets you swap environments by assigning to <identifier>. This
also covers an example of Mark Hamburg:
local c = Class()
in c do ... end
could become
in c do ... c = Class() end
Bye,
Wim
- References:
- Lua registry, environment, and threads., Christian Tellefsen
- Re: Lua registry, environment, and threads., Patrick Donnelly
- Re: Lua registry, environment, and threads., Roberto Ierusalimschy
- Re: Lua registry, environment, and threads., Christian Tellefsen
- Re: Lua registry, environment, and threads., Roberto Ierusalimschy
- Re: Lua registry, environment, and threads., Mark Hamburg
- Re: Lua registry, environment, and threads., Patrick Donnelly
- Re: Lua registry, environment, and threads., Roberto Ierusalimschy