diff options
Diffstat (limited to 'src/tools.c')
-rw-r--r-- | src/tools.c | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/src/tools.c b/src/tools.c index 9a1c19d..c7da63e 100644 --- a/src/tools.c +++ b/src/tools.c | |||
@@ -206,6 +206,14 @@ static const luaL_Reg libs[] = | |||
206 | { LUA_COLIBNAME, NULL}, // Lua 5.1: part of base package | 206 | { LUA_COLIBNAME, NULL}, // Lua 5.1: part of base package |
207 | #endif // LUA_VERSION_NUM | 207 | #endif // LUA_VERSION_NUM |
208 | { LUA_DBLIBNAME, luaopen_debug}, | 208 | { LUA_DBLIBNAME, luaopen_debug}, |
209 | #if defined LUA_JITLIBNAME // building against LuaJIT headers, add some LuaJIT-specific libs | ||
210 | #pragma message( "supporting JIT base libs") | ||
211 | { LUA_BITLIBNAME, luaopen_bit}, | ||
212 | { LUA_JITLIBNAME, luaopen_jit}, | ||
213 | { LUA_FFILIBNAME, luaopen_ffi}, | ||
214 | #endif // LUA_JITLIBNAME | ||
215 | |||
216 | { LUA_DBLIBNAME, luaopen_debug}, | ||
209 | { "lanes.core", require_lanes_core}, // So that we can open it like any base library (possible since we have access to the init function) | 217 | { "lanes.core", require_lanes_core}, // So that we can open it like any base library (possible since we have access to the init function) |
210 | // | 218 | // |
211 | { "base", NULL}, // ignore "base" (already acquired it) | 219 | { "base", NULL}, // ignore "base" (already acquired it) |
@@ -1393,25 +1401,23 @@ static bool_t inter_copy_one_( struct s_Universe* U, lua_State* L2, uint_t L2_ca | |||
1393 | { | 1401 | { |
1394 | bool_t ret = TRUE; | 1402 | bool_t ret = TRUE; |
1395 | bool_t ignore = FALSE; | 1403 | bool_t ignore = FALSE; |
1404 | int val_type = lua_type(L, i); | ||
1396 | STACK_GROW( L2, 1); | 1405 | STACK_GROW( L2, 1); |
1397 | STACK_CHECK( L2); | 1406 | STACK_CHECK( L2); |
1398 | 1407 | ||
1399 | /* Skip the object if it has metatable with { __lanesignore = true } */ | 1408 | /* Skip the object if it has metatable with { __lanesignore = true } */ |
1400 | if( lua_getmetatable( L, i)) // ... mt | 1409 | if( lua_getmetatable( L, i)) // ... mt |
1401 | { | 1410 | { |
1402 | lua_pushstring( L, "__lanesignore"); // ... mt "__lanesignore" | 1411 | lua_getfield( L, -1, "__lanesignore"); // ... mt ignore? |
1403 | lua_gettable( L, -2); // ... mt ignore? | ||
1404 | |||
1405 | if( lua_isboolean( L, -1) && lua_toboolean( L, -1)) | 1412 | if( lua_isboolean( L, -1) && lua_toboolean( L, -1)) |
1406 | { | 1413 | { |
1407 | ignore = TRUE; | 1414 | val_type = LUA_TNIL; |
1408 | } | 1415 | } |
1409 | |||
1410 | lua_pop( L, 2); // ... | 1416 | lua_pop( L, 2); // ... |
1411 | } | 1417 | } |
1412 | 1418 | ||
1413 | /* Lets push nil to L2 if the object should be ignored */ | 1419 | /* Lets push nil to L2 if the object should be ignored */ |
1414 | switch( ignore ? LUA_TNIL : lua_type( L, i)) | 1420 | switch( val_type) |
1415 | { | 1421 | { |
1416 | /* Basic types allowed both as values, and as table keys */ | 1422 | /* Basic types allowed both as values, and as table keys */ |
1417 | 1423 | ||
@@ -1664,6 +1670,7 @@ static bool_t inter_copy_one_( struct s_Universe* U, lua_State* L2, uint_t L2_ca | |||
1664 | 1670 | ||
1665 | /* The following types cannot be copied */ | 1671 | /* The following types cannot be copied */ |
1666 | 1672 | ||
1673 | case 10: // LuaJIT CDATA | ||
1667 | case LUA_TTHREAD: | 1674 | case LUA_TTHREAD: |
1668 | ret = FALSE; | 1675 | ret = FALSE; |
1669 | break; | 1676 | break; |