ds_list_set

This function can be used to set a previously added list entry. It does the same as the DS list accessor.

You give the list ID (as returned when you created the list) and the position within the list to set as well as the value to set it to.

NOTE If the entry being set is outside the bounds of the list (i.e., you set list entry 20 but the current list only contains 10 entries) then the list will be filled to the given position and each entry will be set to 0.

 

Syntax:

ds_list_set(id, pos, val);

Argument Type Description
id DS List The ID of the list to add to.
pos Any The position within the list to set.
[val2, ... max_val] Any The value to set in the list.

 

Returns:

N/A

 

Example:

list = ds_list_create();
ds_list_add(list, 71, 77, 46);
ds_list_set(list, 2, 33);

The above code first creates a new DS list and stores it in an instance variable list. It then adds a few values to the list add finally sets the last value (the third value at index 2) with a call to ds_list_set.