Module:ArgumentPairs demo: Difference between revisions

From Guild of Archivists
m (1 revision imported)
 
(No difference)

Latest revision as of 07:26, 30 October 2015

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