From 553b37ce4ff758d8cf80d48a21287526c92221c6 Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Tue, 29 Dec 2020 13:38:47 -0300 Subject: Do not insert nil values into tables --- ltable.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ltable.c b/ltable.c index e9410f99..e98bab71 100644 --- 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; -- cgit v1.2.3-55-g6feb