[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Lua registry, environment, and threads.
- From: Leo Razoumov <slonik.az@...>
- Date: Sat, 9 Jan 2010 08:26:15 -0500
On 2010-01-09, steve donovan <steve.j.donovan@gmail.com> wrote:
> (BTW, a safer 5.2 idom is:
>
> local loadstring = loadstring
> in {x = 1, y = 10} do fn = loadstring 'return x + y' end
>
> Given that loadstring is potentially a nasty function in a sandbox)
>
> steve d.
Can one do the following instead?
local fn = loadstring 'return x + y' --first compile the chunk for future use
in {x = 1, y = 10, print=print} do print(fn()) end -- 11
in {x = 2, y = 20, print=print} do print(fn()) end -- 22
--Leo--
- References:
- Lua registry, environment, and threads., Christian Tellefsen
- 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
- Re: Lua registry, environment, and threads., steve donovan
- Re: Lua registry, environment, and threads., Leo Razoumov
- Re: Lua registry, environment, and threads., steve donovan