Module:Abilities: Difference between revisions

Jump to navigation Jump to search
added get_ability_number, corrected example calls for functions in comments
removed find_hero_by_ability, function already exists in Module:Abilities/utils
Line 157: Line 157:
return element
return element
end
end
--{{#invoke:Abilities|find_hero_by_ability|ABILITY_NAME}}--
p.find_hero_by_ability = function(frame)
local ability_name = frame.args[1]
if not ability_name or ability_name == "" then
return "Missing Ability Name"
end
-- Iterate through all heroes in the data
for hero_key, ui_data in pairs(data) do
-- Check each ability for this hero
for ability_num, ability in pairs(ui_data) do
local current_name = Lang.get_string(ability.Key)
if current_name == ability_name then
return hero_key
end
end
end
return "Hero Not Found"
end


return p
return p