Sort (Effect) — Skript

Addon: Skript · Category: Effect · Since: 2.9.0, INSERT VERSION (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.

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

View source