From b754b0af38eb24df41557cb771e698972ced10ab Mon Sep 17 00:00:00 2001 From: daurnimator Date: Wed, 24 May 2017 14:35:33 +1000 Subject: src/ltable.js: lightuserdata can include Table/Udata/LClosure/etc due to lua_topointer --- src/ltable.js | 9 ++++++--- 1 file 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); } -- cgit v1.2.3-70-g09d2