Editing Module:AbilitiesGive feedback
Jump to navigation
Jump to search
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 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 | ||
-- 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 | if current_name == ability_name then | ||
return ability_num | return ability_num | ||
end | end | ||
| Line 127: | Line 124: | ||
return "Ability Not Found" | return "Ability Not Found" | ||
end | end | ||
-- Get the list of upgrades for this ability | -- Get the list of upgrades for this ability | ||
local upgrades = ability.Upgrades | local upgrades = ability.Upgrades | ||
| Line 148: | Line 145: | ||
-- Get the desired property from the specific upgrade | -- Get the desired property from the specific upgrade | ||
local element = upgrade[prop] | local element = upgrade[prop] | ||
if | if element == nil then | ||
return "" -- The property doesn't exist in this specific upgrade, which is a valid case. Return empty. | |||
end | |||
-- If the property is a table (like a Damage object), return its Value field | |||
if type(element) == "table" then | |||
return element.Value or "" | |||
end | end | ||