setMapValue()

Synopsis

Stores the value in the given map, under the given key. Map and key names are Names . The table must be already defined using defineMap(). If the map has not been defined, setMapValue() does nothing and returns False . If the map is defined, the given value is stored under the given key. If there was already a value for that key, the old value is discarded.

The value stored may not be a Part , nor may it be a list containing a Part at any level. There is no checking for this at this time. Failure to observe this restriction may lead to crashes.

Syntax

setMapValue ( map As Name, _
              key As Name, _
              value As Any ) As Boolean 
Argument Type Description
map Name The name of the map. Must have been defined using defineMap().
key Name The key to associate with the value.
value Any The value to store.

Example 1

This example defines a map, sets a couple values, defines the map again without resetting it, gets map keys and some values, and finally deletes a map value.
Intent >defineMap(:myMap)
--> True
Intent >setMapValue(:myMap, :myStringValue, "A String")
--> True
Intent >setMapValue(:myMap, :myIntegerValue, 123)
--> True
Intent >defineMap(:myMap, reset? := False)
--> True
Intent >getMapKeys(:myMap)
--> {:myStringValue, :myIntegerValue}
Intent >getMapValue(:myMap, :myStringValue)
--> "A String"
Intent >getMapValue(:noMap, :noValue)
--> NoValue
Intent >deleteMapValue(:myMap, :myIntegerValue)
--> True
Intent >getMapValue(:myMap, :myIntegerValue)
--> NoValue