Module:ISO 3166/testcases explained

local p = local arguments = local function stripOnly(params, special) local code = (special

'code' and '<nowiki>' or '<td>') if params[1] then code = code..(special == 'sandbox' and '{{#invoke:ISO 3166/sandbox' or '{{#invoke:ISO 3166')..'|strip'..'|'..params[1]..'}}' end if params[2] then code = code..' '..(special == 'sandbox' and '{{#invoke:ISO 3166/sandbox' or '{{#invoke:ISO 3166')..'|strip'..'|'..params[2]..'}}' end return code..(special == 'code' and '</nowiki>' or '')endlocal function makeCell(func, params, special) if func

'strip' then return stripOnly(params, special) end local code = code = code..(special

'code' and '<nowiki>' or '<td>')..'{{' code = code..(special == 'sandbox' and '#invoke:ISO 3166/sandbox' or '#invoke:ISO 3166') code = code..'|'..func for k,v in ipairs(params) do code = code..'|'..v end for k,v in pairs(params) do if type(k) ~= 'number' then code = code..'|'..k..'='..v end end code = code..'}}'..(special == 'code' and '</nowiki>' or '') return codeendlocal function makeRow(frame, func, params) local out = out = out..makeCell(func, params) -- Live out = out..makeCell(func, params, 'sandbox') -- Sandbox out = out..makeCell(func, params, 'code') -- Code return frame:preprocess(''..out..'')endfunction p.run(frame) local out = 'LiveSandboxCode' for k,v in ipairs(arguments) do out = out..makeRow(frame, frame.args[1], v) end return '

'endreturn p