Anonymous

Module:Test: Difference between revisions

From Elwiki
114 bytes removed ,  10 October 2023
no edit summary
No edit summary
Tag: Reverted
No edit summary
Tag: Manual revert
Line 281: Line 281:


     -- Function to apply inheritance for a specific argument key
     -- Function to apply inheritance for a specific argument key
     local function applyInheritanceForKey(args, prefix, mainKey, argTable, damageTypeIndex, damageType)
     local function applyInheritanceForKey(args, prefix, mainKey, argTable, damageTypeIndex)
         local mainKeyPrefixed = prefix .. mainKey
         local mainKeyPrefixed = prefix .. mainKey
         local mainArgValues = args[mainKeyPrefixed]
         local mainArgValues = args[mainKeyPrefixed]
Line 293: Line 293:


                 for ix, inheritKey in ipairs(argTable) do
                 for ix, inheritKey in ipairs(argTable) do
                     local inheritArg = args[prefix .. inheritKey .. damageType] or args[inheritKey] or args[prefix .. inheritKey .. damageType] or args[inheritKey]
                     local inheritArg = args[prefix .. inheritKey] or args[inheritKey]


                     if inheritArg and inheritArg[i] and type(inheritArg[i]) ~= "string" and
                     if inheritArg and inheritArg[i] and inheritArg[i] ~= '' and
                         (damageTypeIndex == 1 and ix ~= 1 or damageTypeIndex ~= 1)
                         (damageTypeIndex == 1 and ix ~= 1 or damageTypeIndex ~= 1)
                     then
                     then
Line 316: Line 316:
                 if argTableKey ~= 'provided' and isTableNotEmpty(argTable) then
                 if argTableKey ~= 'provided' and isTableNotEmpty(argTable) then
                     for damageTypeIndex, damageType in ipairs({ '', '_min', '_max' }) do
                     for damageTypeIndex, damageType in ipairs({ '', '_min', '_max' }) do
                         applyInheritanceForKey(args, prefix, argTable[1] .. damageType, argTable, damageTypeIndex, damageType)
                         applyInheritanceForKey(args, prefix, argTable[1] .. damageType, argTable, damageTypeIndex)
                     end
                     end
                 end
                 end