lua-users home
lua-l archive

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


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.