From d7bdbc932ac22df593ba013118c0835c5638d084 Mon Sep 17 00:00:00 2001 From: daurnimator Date: Thu, 11 May 2017 14:39:20 +1000 Subject: src/ltable.js: If you try and set value nil with luaH_setint, delete the entry See #37 --- src/ltable.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/ltable.js b/src/ltable.js index 1b55256..b1f48e8 100644 --- a/src/ltable.js +++ b/src/ltable.js @@ -80,6 +80,10 @@ const setgeneric = function(t, hash, key) { const luaH_setint = function(t, key, value) { assert(typeof key == "number" && (key|0) === key && value instanceof lobject.TValue); let hash = key; /* table_hash known result */ + if (value.ttisnil()) { + t.strong.delete(hash); + return; + } let v = t.strong.get(hash); if (v) { let tv = v.value; -- cgit v1.2.3-70-g09d2