Module:Test2: Difference between revisions

From Elwiki
No edit summary
No edit summary
Line 15: Line 15:
             old_args[old_arg[1]] = old_arg[2]
             old_args[old_arg[1]] = old_arg[2]
         end
         end
       
     end
     end
    args.orig = nil
    old_args = tableMerge(old_args, args)


     --return inspect_dump(frame, old_args)
     --return inspect_dump(frame, old_args)

Revision as of 20:17, 25 April 2023

Documentation for this module may be created at Module:Test2/doc

require('Module:CommonFunctions');
local getArgs = require('Module:Arguments').getArgs
local p = {}

function p.Patch(frame)
    local args = getArgs(frame)

    local input_args = split(mw.text.unstrip(args.orig), '|')
    local old_args = {}
    for k, v in ipairs(input_args) do
        local old_arg = split(v, '=')
        if not old_arg[2] then
            old_args[k] = v
        else
            old_args[old_arg[1]] = old_arg[2]
        end
    end

    args.orig = nil

    old_args = tableMerge(old_args, args)

    --return inspect_dump(frame, old_args)
    return frame:expandTemplate{
        title = 'Damage',
        args = old_args
    }
  
end

return p