|
|
||
|
> -------------
> a = {}
>
> function f (c)
> a[#a+1] = c
> setfenv(c, {})
> end
>
> for i=1,10 do f(function () end) end
>
> assert(getfenv(a[1]) ~= getfenv(a[2]))
> -------------
It can be simpler:
a = {}
function f (c)
a[#a+1] = c
end
for i=1,10 do f(function () end) end
assert(a[1] ~= a[2])
-- Roberto