Merge pull request #353 from 8573/8573/fix/lua/tostring-calls-as-1st-operands-of-or-exprs/1
Lua: Fix uses of `tostring` calls as LHSs to `or`
This commit is contained in:
commit
332e64f945
2 changed files with 6 additions and 5 deletions
|
@ -60,9 +60,10 @@ end
|
||||||
|
|
||||||
function wml_actions.chat(cfg)
|
function wml_actions.chat(cfg)
|
||||||
local side_list = wesnoth.get_sides(cfg)
|
local side_list = wesnoth.get_sides(cfg)
|
||||||
local speaker = tostring(cfg.speaker) or "WML"
|
local speaker = tostring(cfg.speaker or "WML")
|
||||||
local message = tostring(cfg.message) or
|
local message = tostring(cfg.message or
|
||||||
helper.wml_error "[chat] missing required message= attribute."
|
helper.wml_error "[chat] missing required message= attribute."
|
||||||
|
)
|
||||||
|
|
||||||
for index, side in ipairs(side_list) do
|
for index, side in ipairs(side_list) do
|
||||||
if side.controller == "human" then
|
if side.controller == "human" then
|
||||||
|
@ -710,8 +711,8 @@ end
|
||||||
|
|
||||||
function wml_actions.move_unit(cfg)
|
function wml_actions.move_unit(cfg)
|
||||||
local coordinate_error = "invalid coordinate in [move_unit]"
|
local coordinate_error = "invalid coordinate in [move_unit]"
|
||||||
local to_x = tostring(cfg.to_x) or helper.wml_error(coordinate_error)
|
local to_x = tostring(cfg.to_x or helper.wml_error(coordinate_error))
|
||||||
local to_y = tostring(cfg.to_y) or helper.wml_error(coordinate_error)
|
local to_y = tostring(cfg.to_y or helper.wml_error(coordinate_error))
|
||||||
local fire_event = cfg.fire_event
|
local fire_event = cfg.fire_event
|
||||||
local muf_force_scroll = cfg.force_scroll
|
local muf_force_scroll = cfg.force_scroll
|
||||||
local check_passability = cfg.check_passability; if check_passability == nil then check_passability = true end
|
local check_passability = cfg.check_passability; if check_passability == nil then check_passability = true end
|
||||||
|
|
|
@ -81,7 +81,7 @@ end
|
||||||
|
|
||||||
function wml_actions.store_items(cfg)
|
function wml_actions.store_items(cfg)
|
||||||
local variable = cfg.variable or "items"
|
local variable = cfg.variable or "items"
|
||||||
variable = tostring(variable) or helper.wml_error("invalid variable= in [store_items]")
|
variable = tostring(variable or helper.wml_error("invalid variable= in [store_items]"))
|
||||||
wesnoth.set_variable(variable)
|
wesnoth.set_variable(variable)
|
||||||
local index = 0
|
local index = 0
|
||||||
for i, loc in ipairs(wesnoth.get_locations(cfg)) do
|
for i, loc in ipairs(wesnoth.get_locations(cfg)) do
|
||||||
|
|
Loading…
Add table
Reference in a new issue