Map
Jump to navigation
Jump to search
map
is one of the core data types in MiniScript.
Methods
Method | Description |
---|---|
hasIndex(key) | Returns true if the map contains key |
indexes | Returns a list of the map keys |
indexOf(value, after) | Returns the key of the first occurrence of value in the map, or null if not found. Does not search inheritance chain.
|
len | Returns the number of key/value pairs contained in the map |
pop | Removes the most recently added key/value pair and returns the key |
push key | Adds the key to the map and assigns a value of 1 |
pull | Same as pop. |
shuffle | Mutates the map by randomly re-ordering the values assigned to each key within the map |
sum | Returns the sum of all numeric values in the map |
remove key | Removes the key/value pair at key |
replace oldValue, newValue, maxCount | Mutates the map by replacing occurrences of oldValue with newValue at most maxCount, if specified. If maxCount is omitted it replaces all occurrences. |
values | Returns a list values within the map |
See also
- mapUtil - for additional functions on a list