Module:Abilities: Difference between revisions

m Fixed key lookup
LVL (talk | contribs)
Added dot notation support for nested properties in get_ability_prop
Line 61: Line 61:
if(ability == nil) then return "Ability Not Found" end
if(ability == nil) then return "Ability Not Found" end


local element = ability[prop]
-- 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
if element == nil then return "" end
if element == nil then return "" end