[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: setfenv
- From: Luiz Henrique de Figueiredo <lhf@...>
- Date: Sun, 12 Oct 2003 22:53:12 -0200
>function func()
> a=1;
>end
>
>g={}
>setfenv(func, setmetatable(g, {__index=_G}))
>
>What is the correct way to tidy up from here?
>Is it necessary to issue another setfenv() before
>setting g or func to nil?
Setting g to nil has no effect on func after the setfenv call.
I'm not sure what you mean by tidying up. Perhaps it will be clearer if
you use a local g instead of a global one.
>Is func collectable after setting its value to nil or
>does the setfenv() continue to reference func()?
There are no references from env tables to functions, only the other way around.
--lhf