summaryrefslogtreecommitdiff
path: root/src/ltable.js
diff options
context:
space:
mode:
authordaurnimator <quae@daurnimator.com>2017-05-24 14:35:33 +1000
committerdaurnimator <quae@daurnimator.com>2017-05-24 14:38:42 +1000
commitb754b0af38eb24df41557cb771e698972ced10ab (patch)
treef8bb1586d976b970f862e8064ab3441568429842 /src/ltable.js
parente980731dbddb46260d7287373a2cb3a835e30e5a (diff)
downloadfengari-b754b0af38eb24df41557cb771e698972ced10ab.tar.gz
fengari-b754b0af38eb24df41557cb771e698972ced10ab.tar.bz2
fengari-b754b0af38eb24df41557cb771e698972ced10ab.zip
src/ltable.js: lightuserdata can include Table/Udata/LClosure/etc due to lua_topointer
Diffstat (limited to 'src/ltable.js')
-rw-r--r--src/ltable.js9
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);
}