diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2020-12-29 13:38:47 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2020-12-29 13:38:47 -0300 |
commit | 553b37ce4ff758d8cf80d48a21287526c92221c6 (patch) | |
tree | 4125ebc4456f8974bf039ce1e2bcbfdfc3276dc0 | |
parent | 4bd10b6fe81c0a56eb9e01e24fba10e655966870 (diff) | |
download | lua-553b37ce4ff758d8cf80d48a21287526c92221c6.tar.gz lua-553b37ce4ff758d8cf80d48a21287526c92221c6.tar.bz2 lua-553b37ce4ff758d8cf80d48a21287526c92221c6.zip |
Do not insert nil values into tables
-rw-r--r-- | ltable.c | 2 |
1 files changed, 2 insertions, 0 deletions
@@ -647,6 +647,8 @@ void luaH_newkey (lua_State *L, Table *t, const TValue *key, TValue *value) { | |||
647 | else if (unlikely(luai_numisnan(f))) | 647 | else if (unlikely(luai_numisnan(f))) |
648 | luaG_runerror(L, "table index is NaN"); | 648 | luaG_runerror(L, "table index is NaN"); |
649 | } | 649 | } |
650 | if (ttisnil(value)) | ||
651 | return; /* do not insert nil values */ | ||
650 | mp = mainpositionTV(t, key); | 652 | mp = mainpositionTV(t, key); |
651 | if (!isempty(gval(mp)) || isdummy(t)) { /* main position is taken? */ | 653 | if (!isempty(gval(mp)) || isdummy(t)) { /* main position is taken? */ |
652 | Node *othern; | 654 | Node *othern; |