Skip to content
Lists & Helpers arraySort

$arraySort — Sorts an array in place (text by default, asc or desc for numbers) and returns JSON, or stores it in another array.

Sorts an array in place (text by default, `asc` or `desc` for numbers) and returns JSON, or stores it in another array.

Syntax

$arraySort[array;(other);(order)]

Parameters

  • array (text, required) — Name of the array.
  • other (text, optional) — Array that receives the result.
  • order (text, optional) — asc or desc for numeric order.

Return Value

  • string.

Usage

$arraySort[a;;asc] → ["1","2","3"]

Example

$arrayLoad[a;,;3,1,2]
$sendMessage[$arraySort[a;;asc]]

Try it

Paste an example into the playground to preview its message (functions that act on Discord are not run), or build the same thing with blocks.