Module:PrintMultiple

local util_args = require('Module:ArgsUtil') local util_text = require('Module:TextUtil') local p = {}

function p.printMultiple( frame ) local args = util_args.overwrite(frame) local m = require('Module:' .. args['module'])[args['function']] local modargs = {} local constants = {} for key, value in pairs(args) do		-- non constant args will start with arg_ if string.sub(key,0,4) == 'arg_' then -- get all of the individual arg values tbl = util_text.split(value,"%s*,%s*") local key2 = tonumber(string.sub(key, 5)) or string.sub(key, 5) -- assign each arg value to the right instance of the module arguments for i, j in ipairs(tbl) do				if not modargs[i] then modargs[i] = {} end if j ~= '' then modargs[i][key2] = j				end end -- constant args will start with all_ so we just have to track those one time each and then we'll append them to modargs later elseif string.sub(key,0,4) == 'all_' then local key2 = tonumber(string.sub(key, 5)) or string.sub(key, 5) constants[key2] = value end end local text = {} for i, arg_tbl in ipairs(modargs) do		for ckey, cvalue in pairs(constants) do			arg_tbl[ckey] = tonumber(cvalue) or cvalue end text[i] = table.concat{m(arg_tbl)} end local output = table.concat(text,args['sep'] or "") return output end

return p