Sort (Effect) — Skript
Addon: Skript · Category: Effect · Since: 2.9.0, 2.10 (sort order)
Syntax
sort %~objects% [in (descending|ascending) order] [(by|based on) <.+>]Description
Sorts a list variable using either the natural ordering of the contents or the results of the given expression. Be warned, this will overwrite the indices of the list variable.
When using the full <code>sort %~objects% (by|based on) <expression></code> pattern, the input expression can be used to refer to the current item being sorted. (See input expression for more information.)
Examples
set {_words::*} to "pineapple", "banana", "yoghurt", and "apple"
sort {_words::*} # alphabetical sort
sort {_words::*} by length of input # shortest to longest
sort {_words::*} in descending order by length of input # longest to shortest
sort {_words::*} based on {tastiness::%input%} # sort based on custom value