Make ItemStack:set_count(0) clear the item stack
authorsfan5 <sfan5@live.de>
Fri, 15 Jan 2016 12:40:59 +0000 (13:40 +0100)
committersfan5 <sfan5@live.de>
Fri, 15 Jan 2016 12:44:45 +0000 (13:44 +0100)
fixes minetest/minetest_game#786

src/script/lua_api/l_item.cpp

index 842b157090bdbb9e9ce7a1933d9a93c7d22c520d..5381cba7616c0c62378372d4e57b3273e5b17c83 100644 (file)
@@ -94,7 +94,7 @@ int LuaItemStack::l_set_count(lua_State *L)
 
        bool status;
        lua_Integer count = luaL_checkinteger(L, 2);
-       if (count <= 65535) {
+       if (count > 0 && count <= 65535) {
                item.count = count;
                status = true;
        } else {