In logic, a
hashmap is similar to an
array but has dimensions that can be either non-consecutive numbers or strings. A hashmap is an
associative array that can be used to store numbers or strings and can dynamically grow or shrink in size.
A hashmap is a CSPro logic object and the following functions can be called via
dot notation:
Function | Description |
clear | Removes all values from the hashmap. |
contains | Returns whether a specified key exists. |
getKeys | Fills a list with the hashmap's keys. |
length | Returns the number of keys. |
remove | Removes a key. |
Hashmaps can be assigned to other hashmaps, which will replace the initial hashmap with the values of the assigned hashmap:
hashmap_name = another_hashmap_name;
When assigning a hashmap to another hashmap, both must have the same value types, and the dimension types must be compatible.
Individual elements of hashmaps can be retrieved or set by using an index to specify the dimension keys:
hashmap_name(key_value1『, key_value2, ...』) = value_to_set_or_modify;
value_to_retrieve = hashmap_name(key_value1『, key_value2, ...』);