Path: /sdk/add_on/scriptdictionary/
The dictionary object maps string values to values or objects of other types.
Register with RegisterScriptDictionary(asIScriptEngine*)
.
Compile the add-on with the pre-processor define AS_USE_STLNAMES=1 to register the methods with the same names as used by C++ STL where the methods have the same significance. Not all methods from STL is implemented in the add-on, but many of the most frequent once are so a port from script to C++ and vice versa might be easier if STL names are used.
Public C++ interface
class CScriptDictionary
{
public:
void AddRef() const;
void Release() const;
CScriptDictionary &operator=(const CScriptDictionary &other);
void Set(const std::string &key, void *value, int typeId);
bool Get(const std::string &key, void *value, int typeId) const;
void Set(
const std::string &key,
asINT64 &value);
bool Get(
const std::string &key,
asINT64 &value)
const;
void Set(const std::string &key, double &value);
bool Get(const std::string &key, double &value) const;
int GetTypeId(const std::string &key) const;
CScriptArray *GetKeys() const;
bool Exists(const std::string &key) const;
bool IsEmpty() const;
void Delete(const std::string &key);
void DeleteAll();
class CIterator
{
public:
void operator++();
void operator++(int);
bool operator==(const CIterator &other) const;
bool operator!=(const CIterator &other) const;
const std::string &GetKey() const;
int GetTypeId() const;
bool GetValue(
asINT64 &value)
const;
bool GetValue(double &value) const;
bool GetValue(void *value, int typeId) const;
};
CIterator begin() const;
CIterator end() const;
};
Public script interface
- See Also
- Dictionaries in the script language