[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: setfenv/getfenv
 
- From: Tony Finch <dot@...>
 
- Date: Tue, 12 Jan 2010 17:09:51 +0000
 
On Tue, 12 Jan 2010, Enrico Colombini wrote:
>
>   local t = {}
>   local s = "function f() a = 3 print(a) end"
>   local chunk = assert(loadstring(s))
>   -- chunk is currently executed in the global env,
>   -- I'd like to execute it in 't'
>   in t do chunk() end -- no effect in 't'
  local t = {}
  local s = "function f() a = 3 print(a) end"
  local chunk = assert(loadstring("in ... do "..s.." end"))
  chunk(t)
Tony.
-- 
f.anthony.n.finch  <dot@dotat.at>  http://dotat.at/
GERMAN BIGHT HUMBER: SOUTHWEST 5 TO 7. MODERATE OR ROUGH. SQUALLY SHOWERS.
MODERATE OR GOOD.