[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Lua registry, environment, and threads.
- From: steve donovan <steve.j.donovan@...>
- Date: Sat, 9 Jan 2010 13:45:30 +0200
On Sat, Jan 9, 2010 at 1:29 PM, steve donovan <steve.j.donovan@gmail.com> wrote:
> debug.setfenv still works as expected in this context:
A more idiomatic Lua 5.2 way of compiling a function-with-a-context:
> in {x = 1, y = 10, loadstring = loadstring} do fn = loadstring 'return x + y' end
> = fn()
11
There's a temptation to avoid the 'loadstring=loadstring' by giving
the env a __index into _G, but then that _also_ effects the context in
which the function evaluates, which is often not what's intended.
steve d.
- References:
- Lua registry, environment, and threads., Christian Tellefsen
- 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
- Re: Lua registry, environment, and threads., Roberto Ierusalimschy
- Re: Lua registry, environment, and threads., Edgar Toernig
- Re: Lua registry, environment, and threads., Mark Hamburg
- Re: Lua registry, environment, and threads., Leo Razoumov
- Re: Lua registry, environment, and threads., steve donovan