summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordaurnimator <quae@daurnimator.com>2017-05-11 14:39:20 +1000
committerdaurnimator <quae@daurnimator.com>2017-05-11 15:19:33 +1000
commitd7bdbc932ac22df593ba013118c0835c5638d084 (patch)
tree26156cae668b956eb380619fa0798c83247016ff /src
parentd88e93b2465a1e5a8933725c8854a626f2a4214b (diff)
downloadfengari-d7bdbc932ac22df593ba013118c0835c5638d084.tar.gz
fengari-d7bdbc932ac22df593ba013118c0835c5638d084.tar.bz2
fengari-d7bdbc932ac22df593ba013118c0835c5638d084.zip
src/ltable.js: If you try and set value nil with luaH_setint, delete the entry
See #37
Diffstat (limited to 'src')
-rw-r--r--src/ltable.js4
1 files changed, 4 insertions, 0 deletions
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;