Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Lua: Fix uses of
tostring
calls as LHSs to or
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.
- Loading branch information