ds_map_is_list

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.

NOTE This will only detect lists that were added using the ds_map_add_list function.

 

Syntax:

ds_map_is_list(id, key)

ArgumentTypeDescription
idDS MapThe ID of the map to use.
keyStringThe key to check.

 

Returns:

Boolean

 

Example:

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(inventory[? 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 in 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.