Toggle menu
Toggle preferences menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

Module:Sort: Difference between revisions

From Teriock
Content deleted Content added
Created page with "local p = {} function p.parse(frame) local input = frame.args[1] or "" local items = {} for item in string.gmatch(input, "([^,]+)") do table.insert(items, item:match("^%s*(.-)%s*$")) -- Trim whitespace end table.sort(items) return frame:preprocess(table.concat(items, ", ")) end"
 
// via Wikitext Extension for VSCode
Line 13: Line 13:
return frame:preprocess(table.concat(items, ", "))
return frame:preprocess(table.concat(items, ", "))
end
end

return p

Revision as of 23:40, 18 January 2025

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

local p = {}

function p.parse(frame)

    local input = frame.args[1] or ""

    local items = {}
    for item in string.gmatch(input, "([^,]+)") do
        table.insert(items, item:match("^%s*(.-)%s*$")) -- Trim whitespace
    end

    table.sort(items)
    return frame:preprocess(table.concat(items, ", "))
end

return p