[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: luaL_register 5.1
- From: David Burgess <dburgess@...>
- Date: Fri, 4 Nov 2005 01:38:10 +1100
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