commit 553b37ce4ff758d8cf80d48a21287526c92221c6
parent 4bd10b6fe81c0a56eb9e01e24fba10e655966870
Author: Roberto Ierusalimschy <roberto@inf.puc-rio.br>
Date: Tue, 29 Dec 2020 13:38:20 -0300
Do not insert nil values into tables
Diffstat:
1 file changed, 2 insertions(+), 0 deletions(-)
diff --git a/ltable.c b/ltable.c
@@ -647,6 +647,8 @@ void luaH_newkey (lua_State *L, Table *t, const TValue *key, TValue *value) {
else if (unlikely(luai_numisnan(f)))
luaG_runerror(L, "table index is NaN");
}
+ if (ttisnil(value))
+ return; /* do not insert nil values */
mp = mainpositionTV(t, key);
if (!isempty(gval(mp)) || isdummy(t)) { /* main position is taken? */
Node *othern;