[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Lua registry, environment, and threads.
- From: Roberto Ierusalimschy <roberto@...>
- Date: Thu, 7 Jan 2010 18:01:41 -0200
> Roberto Ierusalimschy wrote:
> >The construction "in t do command end" will execute <command> with
> >all global variables being resolved in <t>.
>
> Just to be sure I understood correctly:
> in the above example, if <command> modifies its global environment
> (e.g. by adding/changing variables), will the contents of <t> be
> accordingly changed after the execution of that line?
Yes. The semantics is exactly as Mark explained:
in t do command end
is translated to
do
local _temp = t;
<command>
end
and all acesses to <global> inside command are changed to _temp.global.
-- Roberto
- 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
- Re: Lua registry, environment, and threads., Enrico Colombini