[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: require, module, globals and "magic"
- From: Jerome Vuarand <jerome.vuarand@...>
- Date: Mon, 16 Aug 2010 14:38:06 +0200
2010/8/16 Petite Abeille <petite.abeille@gmail.com>:
> (1) register module with _LOADED (lauxlib.luaL_pushmodule)
> (2) initialize module's _M, _NAME and _PACKAGE (loadlib.modinit)
> (3) execute options (lauxlib.dooptions)
OK.
> (4) set the _ENV of the caller to be the module (lauxlib.set_env).
Not OK, the move to _ENV is to give back to closure the control of
their global variables. If the module wants to change its _ENV, it
should do so explicitly :
_ENV = module(... or 'test', package.seeall)
- References:
- require, module, globals and "magic", Nevin Flanagan
- Re: require, module, globals and "magic", steve donovan
- Re: require, module, globals and "magic", Lorenzo Donati
- Re: require, module, globals and "magic", steve donovan
- Re: require, module, globals and "magic", steve donovan
- Re: require, module, globals and "magic", Luiz Henrique de Figueiredo
- Re: require, module, globals and "magic", Petite Abeille