diff options
Diffstat (limited to 'src/tools.c')
-rw-r--r-- | src/tools.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/tools.c b/src/tools.c index 051e3cc..c13d80d 100644 --- a/src/tools.c +++ b/src/tools.c | |||
@@ -44,6 +44,7 @@ THE SOFTWARE. | |||
44 | #include "universe.h" | 44 | #include "universe.h" |
45 | #include "keeper.h" | 45 | #include "keeper.h" |
46 | #include "lanes.h" | 46 | #include "lanes.h" |
47 | #include "uniquekey.h" | ||
47 | 48 | ||
48 | // functions implemented in deep.c | 49 | // functions implemented in deep.c |
49 | extern luaG_IdFunction copydeep( Universe* U, lua_State* L, lua_State* L2, int index, LookupMode mode_); | 50 | extern luaG_IdFunction copydeep( Universe* U, lua_State* L, lua_State* L2, int index, LookupMode mode_); |
@@ -977,7 +978,7 @@ static bool_t lookup_table( lua_State* L2, lua_State* L, uint_t i, LookupMode mo | |||
977 | static bool_t push_cached_table( lua_State* L2, uint_t L2_cache_i, lua_State* L, uint_t i) | 978 | static bool_t push_cached_table( lua_State* L2, uint_t L2_cache_i, lua_State* L, uint_t i) |
978 | { | 979 | { |
979 | bool_t not_found_in_cache; // L2 | 980 | bool_t not_found_in_cache; // L2 |
980 | void* const p = (void*)lua_topointer( L, i); | 981 | DECLARE_CONST_UNIQUE_KEY( p, lua_topointer( L, i)); |
981 | 982 | ||
982 | ASSERT_L( L2_cache_i != 0); | 983 | ASSERT_L( L2_cache_i != 0); |
983 | STACK_GROW( L2, 3); | 984 | STACK_GROW( L2, 3); |
@@ -986,7 +987,7 @@ static bool_t push_cached_table( lua_State* L2, uint_t L2_cache_i, lua_State* L, | |||
986 | // We don't need to use the from state ('L') in ID since the life span | 987 | // We don't need to use the from state ('L') in ID since the life span |
987 | // is only for the duration of a copy (both states are locked). | 988 | // is only for the duration of a copy (both states are locked). |
988 | // push a light userdata uniquely representing the table | 989 | // push a light userdata uniquely representing the table |
989 | lua_pushlightuserdata( L2, p); // ... p | 990 | push_unique_key( L2, p); // ... p |
990 | 991 | ||
991 | //fprintf( stderr, "<< ID: %s >>\n", lua_tostring( L2, -1)); | 992 | //fprintf( stderr, "<< ID: %s >>\n", lua_tostring( L2, -1)); |
992 | 993 | ||
@@ -996,7 +997,7 @@ static bool_t push_cached_table( lua_State* L2, uint_t L2_cache_i, lua_State* L, | |||
996 | { | 997 | { |
997 | lua_pop( L2, 1); // ... | 998 | lua_pop( L2, 1); // ... |
998 | lua_newtable( L2); // ... {} | 999 | lua_newtable( L2); // ... {} |
999 | lua_pushlightuserdata( L2, p); // ... {} p | 1000 | push_unique_key( L2, p); // ... {} p |
1000 | lua_pushvalue( L2, -2); // ... {} p {} | 1001 | lua_pushvalue( L2, -2); // ... {} p {} |
1001 | lua_rawset( L2, L2_cache_i); // ... {} | 1002 | lua_rawset( L2, L2_cache_i); // ... {} |
1002 | } | 1003 | } |