Set a map key to a value


ds_map_set(id, key, value)

Argument Description
id The id of the map to use.
key The key to set.
value The value to set the key to.

Returns: N/A


With this function you can set the value of a key within a given DS map. You supply the DS map ID value (as returned by the function ds_map_create(), then give the key you want to set and the value to set it to. Keys can be integers or strings, and if the given key does not exist then it will be created for you. This function is the same as using the DS map accessor to set/create a map key/value pair.


if is_undefined(ds_map_find_value(map, "score"))
    ds_map_set(map, "score", 0);

The above code will check to see if the given key exists and if it doesn't then it is created and set.

Back: DS Maps
Next: ds_map_read
© Copyright YoYo Games Ltd. 2018 All Rights Reserved