Module:Abilities: Difference between revisionsGive feedback
Normalize data for get_ability_number |
Gammaton32 (talk | contribs) added nesting function for ability upgrades |
||
| Line 127: | Line 127: | ||
return "Ability Not Found" | return "Ability Not Found" | ||
end | end | ||
-- Handle nested properties via dot notation (e.g., "MaxRage.Scale.Value") | |||
local element = ability | |||
if prop and prop ~= "" then | |||
for segment in string.gmatch(prop, "[^%.]+") do | |||
if type(element) ~= "table" then | |||
return "" -- Can't traverse further | |||
end | |||
element = element[segment] | |||
if element == nil then return "" end | |||
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 | ||