lua-users home
lua-l archive

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


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)