Returns the keys of a map as a new array, in the order they were added.
The result is a copy. Changing the array does not change the map, and later changes to the map do not appear in an array you already took.
Loop over it to visit every pair: for k in map.keys(m), then read the value with map.get().
Syntax
map.keys(id: any map type) -> array<>
map.keys() -> array<>Arguments
| Name | Type | Default | Description |
|---|---|---|---|
| id | any map type | required | The map whose keys are listed. The keys come back as a new array. |
Returns
array<>: A new array holding the keys.
Example
//@version=6
indicator("map.keys: highest key", overlay = false)
var m = map.new<int, float>()
map.put(m, bar_index % 7, close)
plot(array.max(map.keys(m)), "Largest key")See also
Runs on Sidechair