모듈:Sort

리버티게임, 모두가 만들어가는 자유로운 게임
백괴게임>Bd3076님의 2018년 3월 3일 (토) 14:59 판 (새 문서: 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...)
(차이) ← 이전 판 | 최신판 (차이) | 다음 판 → (차이)


모듈 설명문서[보기] [편집] [역사] [새로 고침]
New Bouncywikilogo 60px.gif
이 모듈 문서는 위키백과에서 퍼왔거나 퍼온 것을 기반으로 만들어졌습니다. 따라서 크리에이티브 커먼즈 저작자표시-동일조건변경허락 라이선스로 배포됩니다.

출처: WikiMedia

정렬 모듈입니다.


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