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( 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 |
N/A
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.