Re: improving the module function - package.clean
[
Date Prev][
Date Next][
Thread Prev][
Thread Next]
[
Date Index]
[
Thread Index]
- Subject: Re: improving the module function - package.clean
- From: Jim Jennings <jennings.durham.nc+lua@...>
- Date: 2009年9月16日 07:07:59 -0400
On 2009年9月15日 12:57:41 +0100, Matthew Wild <mwild1@gmail.com> 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.
Jim