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


GML Code Example

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.


GML Code Example

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

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