Skip to content
AlertaChartAlertaScript / docs
AlertaScript / Maps

Reference

Maps

Guides and navigation are localized. Built-in reference descriptions and code examples are maintained in English.

Name / SignatureDescriptionReturns
alerta.map.newmap.new() or map.new<K, V>()Creates a new empty map/dictionary. Pine v6 generic form `map.new<K, V>()` is supported in declarations such as `var map<string, float> levels = map.new<string, float>()` — the "Previous Day and Week Levels" template in the script editor is a worked example.Map
alerta.map.putmap.put(id, key, value)Inserts or updates the value associated with `key` in the map.void
alerta.map.getmap.get(id, key)Returns the value associated with `key`, or `na` if the key is not in the map.any (na if missing)
alerta.map.sizemap.size(id)Returns the number of key/value pairs in the map.int
alerta.map.containsmap.contains(id, key)Returns true if `key` is present in the map.bool
alerta.map.keysmap.keys(id)Returns an array containing every key currently stored in the map. Iteration order is insertion order.array
alerta.map.valuesmap.values(id)Returns an array containing every value currently stored in the map. Iteration order matches `map.keys`.array
alerta.map.removemap.remove(id, key)Removes the entry for `key` from the map. Returns the removed value, or na if the key was not present.any (na if missing)
alerta.map.copymap.copy(id) → mapPine v6: returns a shallow copy of the map.map
alerta.map.put_allmap.put_all(id, id2)Pine v6: copies every entry from `id2` into `id`. Existing keys are overwritten.void
alerta.map.clearmap.clear(id)Removes every entry from the map, leaving it empty.void
AlertaScript

No results found.

Search by name, alias, or keyword.