With this function you can check to see if a DS map is stored in the given map key. If the given key contains a DS map ID, then the function will return true otherwise it will return false.
ds_map_is_map(id, key)
| Argument | Description |
|---|---|
| id | The id of the ds_map to use. |
| key | The key to replace. |
Boolean
var size = ds_map_size(inventory) ;
var key = ds_map_find_first(inventory);
for (var i = 0; i < size; i++;)
{
if ds_map_is_map(inventory, key)
{
ds_map_destroy(key);
}
key = ds_map_find_next(inventory);
}
ds_map_destroy(inventory);
The above code loops through a DS map and checks to see if any of the keys within it are for other DS maps. If they are, then the stored DS map is destroyed, and the at the end of the loop the main DS map is destroyed too.