sdleiF | ||
object iterator RO | Iterator | |
object keys RO | KeysIterate over this object to get all keys: for(k in dict.keys) ... | |
int size RO | Element count | |
string toString RO | Textual form | |
snoitcnuF | ||
function assign(untyped)doesn't return a value | Assign from another objectReplaces current dictionary with dictionary contents from another object. | |
function clear()doesn't return a value | Clear data | |
function clone RO()returns Dictionary | Create 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 untyped | FindReturns the element key or null if not found. | |
function get RO(untyped key)returns untyped | Get 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 string | Get a keyReturns the key of the indexed element (0 <= index < size). | |
function hasKey RO(string key)returns int | Check 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 Dictionary | Create a DictionaryEmpty directory can be also created using the {} expression. | |
function remove(untyped key)doesn't return a value | RemoveRemoves the named or indexed element (depending on the argument type: string or int). | |
function set(untyped key, untyped value)returns untyped | Set 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 |