lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Hoping for some help here.

<code>

function func()
  a=1;
end

g={}
setfenv(func, setmetatable(g, {__index=_G}))

</code>

What is the correct way to tidy up from here?
Is it necessary to issue another setfenv() before
setting g or func to nil? 

Is func collectable after setting its value to nil or
does the setfenv() continue to reference func()? i.e.
should we tidy up with

setfenv(func, original_env);

DB