Dictionary class, available in: Global contextDictionary associates stored values with string keys ("key" is the first argument in get/set/remove functions). Integer key can be used to enumerate all elements (note that while iterating, the elements are returned in no particular order).
Examples:
    var d;
    d=Dictionary.new();
    d.set("name","John");
    d.set("age",44);
Another way of doing the same:
    d={};
    d["name"]="John";
    d["age"]=44;
And the most concise way:
    d={ "name":"John", "age":44 };
Iterating:
    for(var v in d) Simulator.print(v); //values
    for(var k in d.keys) Simulator.print(k+" is "+d[k]); //keys
    for(var i=0;i<d.size;i++) Simulator.print(d.getKey(i)+" is "+d.get(i)); //by index
This class has 14 members:
sdleiF
object iterator ROIterator
object keys ROKeysIterate over this object to get all keys: for(k in dict.keys) ...
int size ROElement count
string toString ROTextual form
snoitcnuF
function assign(untyped)doesn't return a valueAssign from another objectReplaces current dictionary with dictionary contents from another object.
function clear()doesn't return a valueClear data
function clone RO()returns DictionaryCreate a cloneThe resulting clone is a shallow copy (contains the same object references as the original). A deep copy can be obtained through serialization: String.deserialize(String.serialize(object));
function find RO(untyped value)returns untypedFindReturns the element key or null if not found.
function get RO(untyped key)returns untypedGet elementRetrieves the named or indexed element (depending on the argument type: string or int). Accessing nonexistent keys is an error (use hasKey() if necessary).
object.get(key) can be shortened to object[key].
function getKey RO(int index)returns stringGet a keyReturns the key of the indexed element (0 <= index < size).
function hasKey RO(string key)returns intCheck if key existsReturns 1 (interpreted as true) if dictionary contains the supplied key, or 0 (false) otherwise.
Example:
if (obj.hasKey("a"))
x = obj->a;
function new()returns DictionaryCreate a DictionaryEmpty directory can be also created using the {} expression.
function remove(untyped key)doesn't return a valueRemoveRemoves the named or indexed element (depending on the argument type: string or int).
function set(untyped key, untyped value)returns untypedSet elementSet element value for the specified key or index (depending on the argument type: string or int).
Returns the value previously associated with the given key (or index).
object.set(key,value) can be shortened to object[key]=value. Literal string keys can use even shorter notation: object->key=value instead of object.set("key",value)
Note the difference in the returned value:
var old_value=object.set("key",new_value); //'old_value' gets the value previously associated with "key"
var x=object["key"]=new_value; //'x' becomes 'new_value', consistently with the semantics of the assignment operator. The value previously associated with "key" is lost.
Global context