diff options
author | moteus <mimir@newmail.ru> | 2013-12-26 19:27:10 +0400 |
---|---|---|
committer | moteus <mimir@newmail.ru> | 2013-12-26 19:27:10 +0400 |
commit | f59cb16f4a528aafad21ae9a33f482098893d22a (patch) | |
tree | 6fd751108a1a23637f3c032696bf6f4a6b9d23c7 /src | |
parent | bb443b6efefbe62e12154de90a130f76d75b936a (diff) | |
download | lua-llthreads2-f59cb16f4a528aafad21ae9a33f482098893d22a.tar.gz lua-llthreads2-f59cb16f4a528aafad21ae9a33f482098893d22a.tar.bz2 lua-llthreads2-f59cb16f4a528aafad21ae9a33f482098893d22a.zip |
Fix. register bit32 library on Lua5.2
Diffstat (limited to 'src')
-rw-r--r-- | src/llthread.c | 16 |
1 files 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){ | |||
337 | //{ llthread_child | 337 | //{ llthread_child |
338 | 338 | ||
339 | static void open_thread_libs(lua_State *L){ | 339 | static void open_thread_libs(lua_State *L){ |
340 | int top = lua_gettop(L); | ||
341 | |||
342 | /* luaL_openlibs(L); lua_settop(L, top); return; */ | ||
343 | |||
340 | #ifdef LLTHREAD_REGISTER_STD_LIBRARY | 344 | #ifdef LLTHREAD_REGISTER_STD_LIBRARY |
341 | # define L_REGLIB(L, name, G) lua_pushcfunction(L, luaopen_##name); lua_setfield(L, -2, #name) | 345 | # define L_REGLIB(L, name, G) lua_pushcfunction(L, luaopen_##name); lua_setfield(L, -2, #name) |
342 | #else | 346 | #else |
343 | # define L_REGLIB(L, name, G) lutil_require(L, #name, luaopen_##name, G) | 347 | # define L_REGLIB(L, name, G) lutil_require(L, #name, luaopen_##name, G) |
344 | #endif | 348 | #endif |
345 | 349 | ||
346 | int top = lua_gettop(L); | ||
347 | lutil_require(L, "_G", luaopen_base, 1); | 350 | lutil_require(L, "_G", luaopen_base, 1); |
348 | lutil_require(L, "package", luaopen_package, 1); | 351 | lutil_require(L, "package", luaopen_package, 1); |
349 | lua_settop(L, top); | 352 | lua_settop(L, top); |
@@ -364,19 +367,14 @@ static void open_thread_libs(lua_State *L){ | |||
364 | L_REGLIB(L, debug, 1); | 367 | L_REGLIB(L, debug, 1); |
365 | #endif | 368 | #endif |
366 | 369 | ||
367 | #ifdef LUA_BITLIBNAME | ||
368 | L_REGLIB(L, bit, 1); | ||
369 | #endif | ||
370 | |||
371 | #ifdef LUA_JITLIBNAME | 370 | #ifdef LUA_JITLIBNAME |
371 | L_REGLIB(L, bit, 1); | ||
372 | L_REGLIB(L, jit, 1); | 372 | L_REGLIB(L, jit, 1); |
373 | #endif | ||
374 | |||
375 | #ifdef LUA_FFILIBNAME | ||
376 | L_REGLIB(L, ffi, 1); | 373 | L_REGLIB(L, ffi, 1); |
374 | #elif defined LUA_BITLIBNAME | ||
375 | L_REGLIB(L, bit32, 1); | ||
377 | #endif | 376 | #endif |
378 | 377 | ||
379 | |||
380 | lua_settop(L, top); | 378 | lua_settop(L, top); |
381 | #undef L_REGLIB | 379 | #undef L_REGLIB |
382 | } | 380 | } |