Module:Abilities: Difference between revisions

removed find_hero_by_ability, function already exists in Module:Abilities/utils
Normalize data for get_ability_number
Line 60: Line 60:
local ui_data = data[hero_name]
local ui_data = data[hero_name]
if(ui_data == nil) then return "Hero Not Found" end
if(ui_data == nil) then return "Hero Not Found" end
-- Normalize input for case-insensitive comparison
local normalized_input = string.lower(ability_name)
-- Iterate through the hero's abilities to find matching name
-- Iterate through the hero's abilities to find matching name
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 ability_num
return ability_num
end
end