diff options
author | Ilya Uvarenkov <trukanduk@gmail.com> | 2016-04-20 21:21:36 +0300 |
---|---|---|
committer | Ilya Uvarenkov <trukanduk@gmail.com> | 2016-04-20 21:21:36 +0300 |
commit | b36919cac89309e2aa75e8575243be33c9fd5944 (patch) | |
tree | d515133a91b7b7d893eeaf066b7c0ce8a9d5c63e | |
parent | f1b69462a9a7ebf5d761bb8fc3b043b8898969a7 (diff) | |
download | lanes-b36919cac89309e2aa75e8575243be33c9fd5944.tar.gz lanes-b36919cac89309e2aa75e8575243be33c9fd5944.tar.bz2 lanes-b36919cac89309e2aa75e8575243be33c9fd5944.zip |
Added __lanesignore field for metatables
-rw-r--r-- | src/tools.c | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/src/tools.c b/src/tools.c index 3a19605..9a1c19d 100644 --- a/src/tools.c +++ b/src/tools.c | |||
@@ -1392,10 +1392,26 @@ static void push_cached_func( struct s_Universe* U, lua_State* L2, uint_t L2_cac | |||
1392 | static bool_t inter_copy_one_( struct s_Universe* U, lua_State* L2, uint_t L2_cache_i, lua_State* L, uint_t i, enum e_vt vt, enum eLookupMode mode_, char const* upName_) | 1392 | static bool_t inter_copy_one_( struct s_Universe* U, lua_State* L2, uint_t L2_cache_i, lua_State* L, uint_t i, enum e_vt vt, enum eLookupMode mode_, char const* upName_) |
1393 | { | 1393 | { |
1394 | bool_t ret = TRUE; | 1394 | bool_t ret = TRUE; |
1395 | bool_t ignore = FALSE; | ||
1395 | STACK_GROW( L2, 1); | 1396 | STACK_GROW( L2, 1); |
1396 | STACK_CHECK( L2); | 1397 | STACK_CHECK( L2); |
1397 | 1398 | ||
1398 | switch( lua_type( L, i)) | 1399 | /* Skip the object if it has metatable with { __lanesignore = true } */ |
1400 | if( lua_getmetatable( L, i)) // ... mt | ||
1401 | { | ||
1402 | lua_pushstring( L, "__lanesignore"); // ... mt "__lanesignore" | ||
1403 | lua_gettable( L, -2); // ... mt ignore? | ||
1404 | |||
1405 | if( lua_isboolean( L, -1) && lua_toboolean( L, -1)) | ||
1406 | { | ||
1407 | ignore = TRUE; | ||
1408 | } | ||
1409 | |||
1410 | lua_pop( L, 2); // ... | ||
1411 | } | ||
1412 | |||
1413 | /* Lets push nil to L2 if the object should be ignored */ | ||
1414 | switch( ignore ? LUA_TNIL : lua_type( L, i)) | ||
1399 | { | 1415 | { |
1400 | /* Basic types allowed both as values, and as table keys */ | 1416 | /* Basic types allowed both as values, and as table keys */ |
1401 | 1417 | ||