AngelScript
dictionary

Observe: Dictionaries are only available in the scripts if the application registers the support for them. The syntax for using dictionaries may differ for the application you're working with so consult the application's manual for more details.

See Also
dictionary object

The dictionary stores key-value pairs, where the key is a string, and the value can be of any type. Key-value pairs can be added or removed dynamically, making the dictionary a good general purpose container object.

  obj object;
  obj @handle;
  dictionary dict = ({'one', 1}, {'object', object}, {'handle', @handle}};
  if( dict.exists('one') )
  {
    bool found = dict.get('handle', @handle);
    if( found )
    {
      dict.delete('object');
    }
  }
  dict.set('newvalue', 42);
  dict.deleteAll();

Supporting dictionary object and functions

The dictionary object is a reference type, so it's possible to use handles to the dictionary object when passing it around to avoid costly copies.

Operators

  • = assignment

The assignment operator performs a shallow copy of the content.

Methods

  • void set(const string &in key, ? &in value)
  • void set(const string &in key, int64 &in value)
  • void set(const string &in key, double &in value)
  • bool get(const string &in key, ? &out value) const
  • bool get(const string &in key, int64 &out value) const
  • bool get(const string &in key, double &out value) const
  • array<string> @getKeys() const
  • bool exists(const string &in key) const
  • void delete(const string &in key)
  • void deleteAll()
  • bool isEmpty() const
  • uint getSize() const