[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: improving the module function - package.clean
- From: Jim Jennings <jennings.durham.nc+lua@...>
- Date: Wed, 16 Sep 2009 07:07:59 -0400
On Tue, 15 Sep 2009 12:57:41 +0100, Matthew Wild <firstname.lastname@example.org> wrote:
> module() is fairly easy to override in Lua, however
> luaL_register() in the C API is not.
> I think the solution is to shift the responsibility of setting
> _G[modulename] to require(), rather than the modules. Then we are free
> to re-implement require(), or add import(), or anything
I agree. I wrote the Darwin module system
(http://lua-users.org/wiki/JimJennings) in part to achieve the same
effect -- I want to load a module into a sandbox.
I would love to see Lua 5.2 adopt your suggestion of having 'require'
place the loaded module table into the right place.