From f59cb16f4a528aafad21ae9a33f482098893d22a Mon Sep 17 00:00:00 2001 From: moteus Date: Thu, 26 Dec 2013 19:27:10 +0400 Subject: Fix. register bit32 library on Lua5.2 --- src/llthread.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/src/llthread.c b/src/llthread.c index 7404bd7..ffb8235 100644 --- a/src/llthread.c +++ b/src/llthread.c @@ -337,13 +337,16 @@ void llthread_log(lua_State *L, const char *hdr, const char *msg){ //{ llthread_child static void open_thread_libs(lua_State *L){ + int top = lua_gettop(L); + + /* luaL_openlibs(L); lua_settop(L, top); return; */ + #ifdef LLTHREAD_REGISTER_STD_LIBRARY # define L_REGLIB(L, name, G) lua_pushcfunction(L, luaopen_##name); lua_setfield(L, -2, #name) #else # define L_REGLIB(L, name, G) lutil_require(L, #name, luaopen_##name, G) #endif - int top = lua_gettop(L); lutil_require(L, "_G", luaopen_base, 1); lutil_require(L, "package", luaopen_package, 1); lua_settop(L, top); @@ -364,19 +367,14 @@ static void open_thread_libs(lua_State *L){ L_REGLIB(L, debug, 1); #endif -#ifdef LUA_BITLIBNAME - L_REGLIB(L, bit, 1); -#endif - #ifdef LUA_JITLIBNAME + L_REGLIB(L, bit, 1); L_REGLIB(L, jit, 1); -#endif - -#ifdef LUA_FFILIBNAME L_REGLIB(L, ffi, 1); +#elif defined LUA_BITLIBNAME + L_REGLIB(L, bit32, 1); #endif - lua_settop(L, top); #undef L_REGLIB } -- cgit v1.2.3-55-g6feb