Syntax

Variables

Variables let you store values for later use.

{=my_variable;hello}
{$my_variable} // "hello"

Variables support nested keys, which can be used to store values in a more complex structure.

{=user.level;0}
{=user.name;John}
{$user.level} // get the "level" property of the "user" variable, 0
{$user} // get the "user" variable, in this case an object matching { level: 0, name: "John" }

Variable names can also be dynamic

{=id;{user.id}} // 111372124383428608, a definitely real user ID
{=users.{$id}.balance;100}
{$users} // { 111372124383428608: { balance: 100 } }

Arrays

You can create and update arrays.

{=target;{[one;two;three]}}
{$target} // {[one;two;three]}
// Arrays are zero-indexed
{$target.0} // get the first item in the array, "one"
{$target.1} // get the second item in the array, "two"

Finding array items

When using objects with arrays, you can use special syntax to find elements of an array.

{=data;{{
	"myarray": [{
		"id": 1,
		"name": "Rocinante"
	}, {
		"id": 2,
		"name": "Pella"
	}]
}}}

// The format is [key:value], where key is the name of the key to retrieve and value is the value to match against.
{$data.myarray.[id:2].name} // "Pella"

Persisting Variables

See {store} for how to store a variable for later use.