Module:Damage: Difference between revisions

Automatically evaluate outer math
No edit summary
(Automatically evaluate outer math)
Line 23: Line 23:
         if inArgs(v) then
         if inArgs(v) then
             for k2, v2 in spairs(split(args[v])) do
             for k2, v2 in spairs(split(args[v])) do
                -- Check for operators. If detected, evaluate.
                if string.find(v2, '*') or string.find(v2, '+') then
                    v2 = frame:preprocess('{{#expr:' .. v2 .. '}}')
                end
                 -- Check if proper hit count values provided. If empty string detected, inherit from 'hits'.
                 -- Check if proper hit count values provided. If empty string detected, inherit from 'hits'.
                 if string.find(v, 'avg_') and string.find(v, '_hits') and v2 == '' then
                 if string.find(v, 'avg_') and string.find(v, '_hits') and v2 == '' then