Module:Example

local p = {} local getArgs = require('Module:Arguments').getArgs local multiRequire = require('Module:MultiRequire') local string, table = multiRequire('Module:String', 'Module:Table')

- -- function: main(frame: table|frame) -- -- Creates an example of the input template. - function p.main(frame) table.log(table.deepCopy(getArgs(frame, { trim=false, removeBlanks=false }))) local args = getArgs(frame, { trim=false, removeBlanks=false }) local templateToInvoke = string.trim(args[1]) args[1] = nil for i, v in ipairs(args) do		args[i-1] = args[i] args[i] = nil end local ret = {} local isNamed = false for k, v in pairs(args) do		local isNumber = type(k) == 'number' if not isNamed and not isNumber then isNamed = true end table.push(ret, table.concat{ isNumber and  or '\n', '|', isNumber and  or k, isNumber and '' or '=', v }) end local res = frame:expandTemplate{ title=templateToInvoke, args=args } local pre = mw.html.create('pre') :wikitext(			''		) :done return table.concat{ tostring(pre), '\n;Produces:', '\n', res } end

return p