mirror of
https://github.com/wesnoth/wesnoth
synced 2025-04-27 22:04:47 +00:00

This commit changes occurrences of the pattern `tostring(x) or y` to `tostring(x or y)` in the following Lua scripts: - `data/lua/wml-tags.lua` - `data/lua/wml/items.lua` `tostring(x) or y` is unlikely to do what the author intended (and is pointless unless `x` is an object of a custom type with unusual behavior), because `tostring` returns a string (`"false"` or `"nil"`) if `x` is a falsy value (`false` or `nil`), and all strings are truthy in Lua — thus, `tostring(x) or y` will (unless `x` is of a custom type) *always* evaluate to `tostring(x)`, never to `y`. `tostring(x or y)` should, I expect, give the intended behavior.