ds_map_exists

Returns if the given key exists or not in the ds_map specified.

Syntax:

GML Code Example

ds_map_exists(id, key);


Argument Description
id the id of the data structure to check
key the key to check for


Returns: boolean


Description

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


Example:

GML Code 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.


Back: DS Maps



No Examples Submitted

Does this page need better examples? Be the first to Submit

No Edits Suggested

Is this page unclear or not descriptive enough? Suggest an edit to the page and with enough upvotes your changes will be made.

No Questions Have Been Ask

Do you have a question about this page? Ask it Here