Module:Sort
Appearance
From mediawiki.org
This module sorts a list of items separates by pipes. After the f (not one of the items) a separator is specified (for the pipe write {{!}}).
Example:
{{#invoke:Sort|f|, |g|p|hi|d|h}} gives:
d, g, h, hi, p
{{#invoke:Sort|f|{{!}}|g|p|hi|d|h}} gives:
d|g|h|hi|p
This module is referenced by Help:Sorting.
The above documentation is transcluded from Module:Sort/doc. (edit | history)
Editors can experiment in this module’s sandbox (create | mirror) and testcases (create) pages.
Subpages of this module.
Editors can experiment in this module’s sandbox (create | mirror) and testcases (create) pages.
Subpages of this module.
localp={} functionp.f(frame) localt={} localdelim=frame.args[1] -- This adds all arguments, including named parameters, -- in an unspecified order, but fields for consecutive values -- starting at 1 will probably be in numerical order. forn,vinpairs(frame.args)dotable.insert(t,v)end table.remove(t,1) table.sort(t) returntable.concat(t,delim) end returnp