Module:Arcangel/Testing

From RimWorld Wiki
Jump to navigation Jump to search

Documentation for this module may be created at Module:Arcangel/Testing/doc

local p = {}

function p.alpha(frame)
    items = splitLine2( frame.args[1] ); -- Delimited will be comas.
    table.sort( items );
	return table.concat( items, ", " );
end
function p.beta(frame)
    items = splitLine2( frame.args[1] );
    table.sort( items, function (a, b) return a > b end );
    return table.concat( items, ", " );
end
-- Link
function p.Lalpha(frame)
    items = splitLine2( frame.args[1] ); -- Delimited will be comas.
    table.sort( items );
	return table.concat( "[[", items, "]], " );
end
function p.Lbeta(frame)
    items = splitLine2( frame.args[1] );
    table.sort( items, function (a, b) return a > b end );
	return table.concat( "[[", items, "]], " );
end
-- Loot Item
function p.LIalpha(frame)
    items = splitLine2( frame.args[1] ); -- Delimited will be comas.
    table.sort( items );
	return table.concat( "{{Loot Item|", items, "}}, " );
end
function p.LIbeta(frame)
    items = splitLine2( frame.args[1] );
    table.sort( items, function (a, b) return a > b end );
	return table.concat( "{{Loot Item|", items, "}}, " );
end

function splitLine2( text )
    return mw.text.split( text, ", ", true );
end

function p.link()
end



function p.asc(frame)
	sep = frame.args[2] or ","
    items = splitLine( frame.args[1], sep );
    table.sort( items );
    return table.concat( items, sep );
end

function p.des(frame)
	sep = frame.args[2] or ","
    items = splitLine( frame.args[1], sep );
    table.sort( items, function (a, b) return a > b end );
    return table.concat( items, sep );
end

function splitLine( text, sep )
    return mw.text.split( text, sep , true );    
end



return p