This function will replace the value at the given position for another one.
WARNING Attempting to replace an item at a position out of bounds results in an error, e.g. ds_list_replace :: Trying to access an out-of-bounds index [| 4].
ds_list_replace(id, pos, val);
Argument | Type | Description |
---|---|---|
id | DS List | The id of the list to change. |
pos | Real | The position to replace the value, where 0 corresponds to the very beginning of the list and the final position is ds_list_size(id)-1. |
val | Any | The new value to replace the given value with. |
N/A
ds_list_replace(n_list, 3, name);
The above code will replace the value stored at position 3 in the list for that stored in the variable "name".