[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: using setfenv recursively
- From: "Patrick Donnelly" <batrick.donnelly@...>
- Date: Mon, 5 Nov 2007 01:01:17 -0700
Lua 5.1.2 Copyright (C) 1994-2007 Lua.org, PUC-Rio
> function protectedEnv(func)
>> local env = { }
>> setmetatable(env, {__index = _G});
>> setfenv(func, env);
>> return func;
>> end;
> t = { }
> for i=1,10 do t[i] = protectedEnv(function() end); end;
> for i=1,10 do print(getfenv(t[i])) end
table: 0x8081270
table: 0x8080590
table: 0x8080aa8
table: 0x8080f20
table: 0x80813d0
table: 0x807b6a8
table: 0x8081470
table: 0x80801d0
table: 0x80808c8
table: 0x8080e18
>
I think you need to provide more information?
--
-Patrick Donnelly
"One of the lessons of history is that nothing is often a good thing
to do and always a clever thing to say."
-Will Durant