[Lua] Fix some accidental global warnings

This commit is contained in:
Celtic Minstrel 2024-02-04 16:20:21 -05:00
parent d1bab92d4f
commit f082ce89f7
3 changed files with 4 additions and 4 deletions

View file

@ -878,7 +878,7 @@ function battle_calcs.attack_rating(attacker, defender, dst, cfg, cache)
-- If defender is on a healing location, count that as slightly more than the healing amount
def_damage = def_damage - 1.25 * wesnoth.terrain_types[map[defender]].healing
if (def_damage < 0) then damage = 0. end
if (def_damage < 0) then def_damage = 0. end
-- Fraction damage (= fractional value of the unit)
local def_value_fraction = def_damage / defender.max_hitpoints

View file

@ -21,7 +21,7 @@ local function is_number(value, check_int, ai_type, name)
if (number ~= math.floor(number)) then
return false
elseif (math.type(number) ~= 'integer') then
str = "[micro_ai] tag (" .. ai_type .. ") parameter '" .. name .. "' must be an integer. It has an integer representation, but is provided in floating-point format."
local str = "[micro_ai] tag (" .. ai_type .. ") parameter '" .. name .. "' must be an integer. It has an integer representation, but is provided in floating-point format."
warn(str)
std_print(str .. ' (see Lua console for stack trace)')
end
@ -365,7 +365,7 @@ function micro_ai_helper.micro_ai_setup(cfg, CA_parms, required_keys, optional_k
end
end
if is_invalid then
str = "[micro_ai] tag (" .. cfg.ai_type .. ") contains invalid parameter: [" .. t[1] .. "]"
local str = "[micro_ai] tag (" .. cfg.ai_type .. ") contains invalid parameter: [" .. t.tag .. "]"
warn(str)
std_print(str .. ' (see Lua console for stack trace)')
end

View file

@ -31,7 +31,7 @@ return function(eventname, priority, fcn)
priority = priority,
first_time_only = false,
action = function()
context = wesnoth.current.event_context
local context = wesnoth.current.event_context
wesnoth.experimental.game_events.set_undoable(true)
fcn(context)
end