diff --git a/data/lua/location_set.lua b/data/lua/location_set.lua index 65ba3e25ff4..a9b61f180a5 100644 --- a/data/lua/location_set.lua +++ b/data/lua/location_set.lua @@ -29,10 +29,12 @@ function locset_meta:__index(loc) end function locset_meta:__newindex(loc, val) + local fcn = methods.insert + if val == nil then fcn = methods.remove end if loc.x and loc.y then - self:insert(loc.x, loc.y, val) + fcn(self, loc.x, loc.y, val) else - self:insert(loc[1], loc[2], val) + fcn(self, loc[1], loc[2], val) end end diff --git a/data/lua/wml/items.lua b/data/lua/wml/items.lua index c0881513ddb..497d096f02c 100644 --- a/data/lua/wml/items.lua +++ b/data/lua/wml/items.lua @@ -36,7 +36,7 @@ function wesnoth.interface.remove_item(x, y, name) end end if not name or #items == 0 then - scenario_items:insert(x, y, nil) + scenario_items:remove(x, y) end end