Module:Sort: Difference between revisions
Appearance
m 1 revision imported |
Caleb Cooper (talk | contribs) m 1 revision imported |
(No difference)
| |
Latest revision as of 15:04, 28 January 2020
Documentation for this module may be created at Module:Sort/doc
local p = {}
function p.asc(frame)
items = splitLine( frame.args[1] );
table.sort( items );
return table.concat( items, "\n" );
end
function p.desc(frame)
items = splitLine( frame.args[1] );
table.sort( items, revComp );
return table.concat( items, "\n" );
end
function splitLine( text )
return mw.text.split( text, "\n", true );
end
function revComp( a, b )
return a > b;
end
return p