Module:Abilities/utils: Difference between revisions

m Default exclude_plus to false
mNo edit summary
Tag: Manual revert
 
(13 intermediate revisions by 4 users not shown)
Line 19: Line 19:
end
end
return nil
return nil
end
-- Returns the key of the hero whose ability name is passed as an argument
--{{#invoke:Abilities/utils|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
-- Normalize input for case-insensitive comparison
local normalized_input = string.lower(ability_name)
-- 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 string.lower(current_name) == normalized_input then
return hero_key
end
end
end
return "Hero Not Found"
end
end


Line 68: Line 94:
prefix..value,  
prefix..value,  
postfix,
postfix,
uom_style = 'font-size: 12px;'
uom_style = 'font-size: 0.8em; color: #9C9C9C'
}
}
}
}