Difference between revisions of "Module:SortList"

From Blaseball Wiki

m (OliverIsARobot moved page Module:ReverseList to Module:SortList without leaving a redirect)
m
Tag: 2017 source edit
Line 1: Line 1:
 
local p = {}
 
local p = {}
  
function p.asc(frame)
+
function p(frame)
 
     items = splitLine( frame.args[1] );
 
     items = splitLine( frame.args[1] );
 
     table.sort( items );
 
     table.sort( items );
 
     return table.concat( items, "\n" );     
 
     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
 
end
  
Line 16: Line 10:
 
     return mw.text.split( text, "\n", true );     
 
     return mw.text.split( text, "\n", true );     
 
end
 
end
 
 
  
 
return p
 
return p

Revision as of 01:21, 6 October 2020

local p = {}

function p(frame)

   items = splitLine( frame.args[1] );
   table.sort( items );
   return table.concat( items, "\n" );    

end

function splitLine( text )

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

end

return p