Module:SortList

From Blaseball Wiki

Revision as of 01:09, 6 October 2020 by OliverIsARobot (talk | contribs) (reverse some text)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

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, function (a, b) return a > b end );
   return table.concat( items, "\n" );

end

function splitLine( text )

   return mw.text.split( text, "\n", true );    

end


return p