This page is for an old version of Hexaly Optimizer. We recommend that you update your version and read the documentation for the latest stable release.

This module contains types and functions to manipulate and build maps.

Map module

type map

This is the base type for maps. Maps are data structure matching some values to some keys. A map is both an associative table and an array. Keys and values can be of any type except nil that has a special meaning. The value associated to a key is set or retrieved by using the “bracket” notation. For instance, a[k] returns the value associated to the key k from the map a. If there is no value associated to the given key, nil is returned. Setting the value of an existing key will overwrite the previous value associated to the key.

count()

Counts the number of values in the map.

values()

Returns the values of the map in a new map.

keys()

Returns the keys of the map in a new map.

add(value)

Adds the given value in the map with key equals to the largest integer key presents in the map plus one.