lua-users home
lua-l archive

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


Whwn registering a library I believe it is necessary to lua_call the
luaopen_ function (methinks so that LUA_ENVIRONINDEX works).
Someone tell me if I am wrong.
My question is when I wish to add some functions to an existing
namespace do I also need to lua_call or can I simply call
luaL_register
against the existing table?

e.g.

    lua_pushcfunction(L, luaopen_mylib);
    lua_pushstring(L, "mylib");
    lua_call(L, 1, 0);

[sometime later]
  static struct luaL_Reg morefuncs[] = {
    {NULL,NULL}
 } ;
 /* presume the following does not require lua_call */
 luaL_register(L, "mylib", morefuncs);

 David B