ds_list_replace

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].

 

Syntax:

ds_list_replace(id, pos, val);

ArgumentTypeDescription
idDS ListThe id of the list to change.
posRealThe 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.
valAnyThe new value to replace the given value with.

 

Returns:

N/A

 

Example:

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".