lua-users home
lua-l archive

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

2011/10/19 Javier Guerra Giraldez <>:
> On Wed, Oct 19, 2011 at 4:15 PM, Hisham <> wrote:
>>   env = f(env) -- <=== allow f to redefine env
> A: a small bug, this returned `env` isn't put back into packages.loaded

That was intentional: the returned environment sees Lua globals, but
the module in packages.loaded contains only the functions exported by
the module. This is done to avoid the problem with package.seeall
where you end up accessing every global through the module.

> B: your 'f' can add a metatable to env and it will hold, no need to
> return it back.

Yes, the point was to produce a different table.

-- Hisham -