diff options
Diffstat (limited to 'apps/plugins/lua/rocklua.c')
| -rw-r--r-- | apps/plugins/lua/rocklua.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/apps/plugins/lua/rocklua.c b/apps/plugins/lua/rocklua.c index 4f328dd..5539618 100644 --- a/apps/plugins/lua/rocklua.c +++ b/apps/plugins/lua/rocklua.c @@ -26,8 +26,7 @@ #include "rocklib.h" #include "luadir.h" -#undef LUA_BITLIBNAME -#define LUA_BITLIBNAME "bit" + static const luaL_Reg lualibs[] = { {"", luaopen_base}, @@ -35,7 +34,7 @@ static const luaL_Reg lualibs[] = { {LUA_STRLIBNAME, luaopen_string}, {LUA_OSLIBNAME, luaopen_os}, {LUA_ROCKLIBNAME, luaopen_rock}, - {LUA_BITLIBNAME, luaopen_bit32}, + {LUA_BITLIBNAME, luaopen_bit}, {LUA_IOLIBNAME, luaopen_io}, {LUA_LOADLIBNAME, luaopen_package}, {LUA_MATHLIBNAME, luaopen_math}, @@ -44,10 +43,11 @@ static const luaL_Reg lualibs[] = { }; static void rocklua_openlibs(lua_State *L) { - const luaL_Reg *lib; - for (lib = lualibs; lib->func; lib++) { - luaL_requiref(L, lib->name, lib->func, 1); - lua_pop(L, 1); /* remove lib */ + const luaL_Reg *lib = lualibs; + for (; lib->func; lib++) { + lua_pushcfunction(L, lib->func); + lua_pushstring(L, lib->name); + lua_call(L, 1, 0); } } |