mirror of
https://github.com/lua/lua
synced 2024-12-29 13:49:44 +03:00
Do not insert nil values into tables
This commit is contained in:
parent
4bd10b6fe8
commit
553b37ce4f
2
ltable.c
2
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;
|
||||
|
Loading…
Reference in New Issue
Block a user