lua-users home
lua-l archive

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


On Aug 16, 2010, at 1:45 PM, Luiz Henrique de Figueiredo wrote:

> Once this magic is removed from module, the very little that
> is left is better made explicit.

Disagree. 

While part of the the behavior of lauxlib.luaL_pushmodule might be controversial (mangling global variables), the other functionalities of loadlib.ll_module are useful in and by themselves. Namely, (1) register module with _LOADED (lauxlib.luaL_pushmodule), (2) initialize module's _M, _NAME and _PACKAGE (loadlib.modinit), (3) execute options (lauxlib.dooptions), and (4) set the _ENV of the caller to be the module (lauxlib.set_env).

Keep these functionalities. Get rid of luaL_pushmodules' lua_pushglobaltable if you must.