Module:ArgumentPairs demo

From Guild of Archivists

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

local p = {}
 
function comp(x,y)
    return tostring(x[1])<tostring(y[1])
end
 
function p.f(frame)
    local t={}
    for n,v in frame:argumentPairs() do table.insert (t,{n,v}) end
    table.sort (t,comp)
    r = '{|class="wikitable sortable"\n!name!!value\n'
    for i,nv in ipairs(t) do r = r..'|-\n|'..nv[1]..'||'..nv[2]..'\n' end
    r=r..'|}'
    return r
end
 
return p