Maps

Maps — sometimes called associative arrays, hashes, or dictionaries in other programming languages, store a collection of key-value pairings. Maps are constructed as a comma-separated list of key-value pairs enclosed by curly braces. Each key-value pair uses a colon to differentiate between the key and the value.

{
    "name": "Ghost",
    "value": 57.3,
    "handler": function(x) { x * x}
}

Accessing Elements

You can access any element in a map by calling the subscript operator on it with the key of the element you want.

people := {"Artemis": 35, "Rabbit": 37, "Orion": 43}

print(people["Artemis"])  // >> 35
print(people["Rabbit"])   // >> 35
print(people["Orion"])    // >> 35

Calling a key that does not exist will return a null value.

print(people["Arasuka"])  // >> null