[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: 5.2 _ENV garbage collection question
- From: Peter Cawley <lua@...>
- Date: Mon, 27 Jun 2011 14:02:33 +0100
On Mon, Jun 27, 2011 at 1:57 PM, Gaspard Bucher <gaspard@teti.ch> wrote:
> This means that the required script gets the original global _ENV even
> though _LOADED._G has been changed. It can also read the first "foo".
>
> It seems that removing _LOADED._G is not enough to purge "foo"...
That would be because when a chunk is loaded, it is assigned as its
environment the value require"debug".getregistry()[2]. The environment
for your first chunk was from here, so unless changed, your second
chunk gets the same thing from here.