Module:AbilityTable/ComplexRenderers: Difference between revisions

Jump to navigation Jump to search
Vergir (talk | contribs)
m delete duplicate function
Vergir (talk | contribs)
Fix is_base_property false positives from modifier metadata strings: remove table recursion since debuff props are always top-level keys (with help from vergir-bot LLM)
Line 47: Line 47:
end
end


-- Returns true if prop exists with a non-zero value anywhere in the record
-- Returns true if prop exists with a non-zero value at the top level of the
-- excluding the Upgrades key.
-- record, excluding the Upgrades key. Does not recurse into sub-tables to
-- avoid false positives from modifier metadata (e.g. prop names appearing as
-- string values inside AutoRegisterModifierValueFromAbilityPropertyName).
-- Value-objects like { Value = N } are unwrapped via the k == prop branch.
-- Name-based list entries (e.g. "Card Trick") match via the string branch
-- against the top-level Name field.
local function is_base_property(record, prop)
local function is_base_property(record, prop)
     for k, v in pairs(record) do
     for k, v in pairs(record) do
Line 58: Line 63:
                 return true
                 return true
             end
             end
        elseif type(v) == "table" then
            if is_base_property(v, prop) then return true end
         elseif type(v) == "string" then
         elseif type(v) == "string" then
             if v == prop then return true end
             if v == prop then return true end