Idi na sadržaj

Modul:Sort list

S Wikipedije, slobodne enciklopedije
Datum izmjene: 1 juli 2020 u 20:57; autor: Semso98 (razgovor | doprinosi) (Nova stranica: local p = {} function p.asc(frame) items = splitLine( frame.args[1] ); table.sort( items ); return table.concat( items, "\n" ); end function p.desc(frame) ite...)
(razl) ← Starija izmjena | Trenutna verzija (razl) | Novija izmjena → (razl)

Dokumentaciju za ovaj modul možete napraviti na stranici Modul:Sort list/dok

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