localgetArgs=require('Module:Arguments').getArgslocalclist=require('Module:Collapsible list').mainlocalcompressSparseArray=require('Module:TableTools').compressSparseArraylocalp={}--[[Combine named-and-numbered arguments into a pretty list."Named-and-numbered" means foo, foo0, foo_1, foo234: anything that matches foo_?%d+Arguments: args[1] = name to search arguments rest of args = arguments to searchReturns: Pretty list, in order of argument number. "foo" comes first, then "foo0", "foo1", ... "fooN" The argument numbering does not have to be sequential If number of args that match <= args[_limit] (4 default), returns text list of the form "A, B, C and D" otherwise returns collapsible list ({{clist}})--]]functionp._main(args)localpattern="^"..args[1].."_?(%d+)$"-- pattern to matchlocalvalues={}fork,vinpairs(args)do--- loop through all argumentsifk==args[1]then--- if argument is just "foo", put it firstvalues[1]=velseord=tonumber(mw.ustring.match(k,pattern))--- if "foo_?%d+", extract numberifordthenvalues[ord+2]=v--- put value into list at number+2 (to keep "foo" first, even for foo0)endendendvalues=compressSparseArray(values)--- squeeze out gaps/nils in values, keep orderinglocallimit=tonumber(args._limit)or4if#values>limitthenreturnclist(values)--- if longer than limit, call Module:Collapsible listendreturnmw.text.listToText(values)--- otherwise just print out pretty text listendfunctionp.main(frame)localargs=getArgs(frame)returnp._main(args)endreturnp