Fix inability to change metadata using stack:to_table() (#5547)
authornumberZero <silverunicorn2011@yandex.ru>
Wed, 12 Apr 2017 14:51:07 +0000 (18:51 +0400)
committerSmallJoker <SmallJoker@users.noreply.github.com>
Wed, 12 Apr 2017 14:51:07 +0000 (16:51 +0200)
src/script/lua_api/l_item.cpp

index 19b5b09550dd6e9a0b6192844cda8643840c6ee5..2d32093a73431a883ac7d5c825435ebab336bbc6 100644 (file)
@@ -234,6 +234,8 @@ int LuaItemStack::l_to_table(lua_State *L)
                for (StringMap::const_iterator it = fields.begin();
                                it != fields.end(); ++it) {
                        const std::string &name = it->first;
+                       if (name.empty())
+                               continue;
                        const std::string &value = it->second;
                        lua_pushlstring(L, name.c_str(), name.size());
                        lua_pushlstring(L, value.c_str(), value.size());