Module:Abilities/utils: Difference between revisions

corrected example call for find_hero_by_ability
mNo edit summary
Tag: Manual revert
 
(10 intermediate revisions by 3 users not shown)
Line 29: Line 29:
return "Missing Ability Name"
return "Missing Ability Name"
end
end
-- Normalize input for case-insensitive comparison
local normalized_input = string.lower(ability_name)
-- Iterate through all heroes in the data
-- Iterate through all heroes in the data
Line 34: Line 37:
-- Check each ability for this hero
-- Check each ability for this hero
for ability_num, ability in pairs(ui_data) do
for ability_num, ability in pairs(ui_data) do
local current_name = Lang.get_string(ability.Key)
local current_name = lang.get_string(ability.Key)
if current_name == ability_name then
if string.lower(current_name) == normalized_input then
return hero_key
return hero_key
end
end