Replaces the value of a given key in the map with a new value.


ds_map_replace( id, key, val );

Argument Description
id The id of the map to change.
key The key with the value that should be replaced by the new one
val The new value to replace the given value with

Returns: N/A.


With this function you can change the value for the given key within the (previously created) ds_map. Please note that if the key to be replaced does not exists, it is created and the given value assigned to it.


ds_map_replace(inventory, "torso", 55);

The above code looks up the ds_map for the key "torso" and when it finds it (or it is created if it doesn't exist) the current value is replaced with the one specified.

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