모듈:Sortstring: 두 판 사이의 차이

리버티게임(개발), 모두가 만들어가는 자유로운 게임
둘러보기로 이동 검색으로 이동
백괴게임>Bd3076
편집 요약 없음
백괴게임>Bd3076
편집 요약 없음
2번째 줄: 2번째 줄:


function p.sort(str)
function p.sort(str)
items = getParameters(str.args[1]);
items = mw.text.split(str.args[1], "");
table.sort(items);
table.sort(items);
return table.concat(items, "");
return table.concat(items, "");

2018년 6월 8일 (금) 17:20 판


모듈 설명문서[보기] [편집] [역사] [새로 고침]

스크립트 오류: 모듈이 nil 값을 반환했습니다. 내보내기 테이블을 반환해야 합니다.


local p = {}       

function p.sort(str)
	items = mw.text.split(str.args[1], "");
	table.sort(items);
	return table.concat(items, "");
end

function getParameters( frame_args, arg_list )
    local new_args = {};
    local index = 1;
    local value;
    
    for i,arg in ipairs( arg_list ) do
        value = frame_args[arg]
        if value == nil then
            value = frame_args[index];
            index = index + 1;
        end
        new_args[arg] = value;
    end
    
    return new_args;
end