With this function you can check to see if a DS list is stored in the given map key. If the given key contains a DS list ID, then the function will return true otherwise it will return false.
ds_map_is_list(id, key)
| Argument | Description |
|---|---|
| id | The id of the ds_map to use. |
| key | The key to check. |
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_list(inventory, key)
{
ds_list_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 a DS list. If they are, then the DS list is destroyed, and the at the end of the loop the DS map is destroyed too.