ds_map_exists

This function will return true if the specified key exists in the (previously created) DS map , and false if it does not.

 

Syntax:

ds_map_exists(id, key);

ArgumentTypeDescription
idDS MapThe id of the data structure to check
keyStringThe key to check for

 

Returns:

Boolean

 

Example:

if (!ds_map_exists(inventory, "potions"))
{
    ds_map_add(inventory, "potions", 1);
}

The above code will check the DS map indexed in the variable "inventory" for the key "potions" and if it doesn't exist it will add it to the map.