[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: modules, require, magic
- From: Hisham <hisham.hm@...>
- Date: Wed, 19 Oct 2011 19:51:15 -0200
2011/10/19 Javier Guerra Giraldez <javier@guerrag.com>:
> On Wed, Oct 19, 2011 at 4:15 PM, Hisham <hisham.hm@gmail.com> 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
http://hisham.hm/ - http://luarocks.org/
- References:
- modules, require, magic, Eduardo Ochs
- Re: modules, require, magic, Javier Guerra Giraldez
- Re: modules, require, magic, Petite Abeille
- Re: modules, require, magic, Sam Roberts
- Re: modules, require, magic, David Manura
- Re: modules, require, magic, Hisham
- Re: modules, require, magic, Roberto Ierusalimschy
- Re: modules, require, magic, Fabio Mascarenhas
- Re: modules, require, magic, Roberto Ierusalimschy
- Re: modules, require, magic, Hisham
- Re: modules, require, magic, Roberto Ierusalimschy
- Re: modules, require, magic, Hisham
- Re: modules, require, magic, Javier Guerra Giraldez