Skip to content

Lists and dictionaries

Declare List<T> with an explicit element type, such as List<Number>. Create the list before appending. Operations cover creation, append, insertion, indexed access/removal, length, search, sorting, shuffling, reversing, trimming, and duplicate removal.

Indices start at 1, not zero. An unsuccessful index search returns 0; do not pass that directly to Get List Value. Check for zero first. An out-of-range index is an error, not a request to automatically extend a list.

Create List → Private List<Number> scores
Append Value to List → scores, 10
Append Value to List → scores, 20
Get List Value → Private Number first, scores, 1

The first value is 10. These lines describe Set Variable operations and their configured slots.

Declare Dictionary<K,V> with exact key/value types. Create an empty dictionary or provide equally sized key/value lists. Use set/get, size, keys/values, append, clear, removal, and sorting operations.

Keys may be non-null Number, String, Boolean, Color, entity Targets, or custom objects. Lists/dictionaries cannot be keys. Primitive keys compare by value; Target keys by UUID; custom-object keys by identity.

Create Dictionary → Private Dictionary<String,Number> scores
Set Dictionary Value → scores, "Alex", 10
Dictionary Has Key → scores, "Alex"
Get Dictionary Value → Private Number score, scores, "Alex"

Check for a missing key before reading when absence is possible. Conditional removal can require matching expected values. Has Keys supports the available Any/All choice. Dictionary sorting supports Number/String keys or values and ascending/descending order; an optional source lets you sort into another dictionary.

Collections are invariant: List<Child> does not become List<Parent>, and dictionary key/value types must match. Assigning a collection by Reference shares its contents. Reassigning one Variable does not rebind the other Variable.

Use input copying to isolate containers. Save collections retain supported object identities, aliases, and cycles across restart. A collection loop for dictionaries is not currently provided; extract Keys/Values and use supported list iteration when suitable.