diff options
-rw-r--r-- | src/ltable.js | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/ltable.js b/src/ltable.js index df2d4f7..cd45fcf 100644 --- a/src/ltable.js +++ b/src/ltable.js @@ -62,9 +62,12 @@ const table_hash = function(L, key) { indirect via a weakmap */ return get_lightuserdata_hash(v); case "object": - /* v shouldn't be a CClosure, LClosure, Table or Userdata from this state as they're never exposed - the only exposed internal type is a lua_State */ - if (v instanceof lstate.lua_State && v.l_G === L.l_G) { + /* v could be a lua_State, CClosure, LClosure, Table or Userdata from this state as returned by lua_topointer */ + if ((v instanceof lstate.lua_State && v.l_G === L.l_G) || + v instanceof Table || + v instanceof lobject.Udata || + v instanceof lobject.LClosure || + v instanceof lobject.CClosure) { /* indirect via a weakmap */ return get_lightuserdata_hash(v); } |