Editing Module:AbilitiesGive feedback
The edit can be undone.
Please check the comparison below to verify that this is what you want to do, and then publish the changes below to finish undoing the edit.
| Latest revision | Your text | ||
| Line 162: | Line 162: | ||
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 | ||