ds_list_set

This function can be used to set a previously added list entry. 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 that if the entry being set is outside the bounds of the list (ie, 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. This function is the same as using the DS list accessor.

 

 

Syntax:

ds_list_set(id, pos, val);

ArgumentTypeDescription
idDS ListThe id of the list to add to.
posAnyThe position within the list to set.
[val2, ... max_val]AnyThe value to set in the list.

 

Returns:

N/A

 

Example:

for (var i = 0; i < ds_list_size(list); i++;)
{
    ds_list_set(list, i, -1);
}

The above code will add the value stored in the "score" variable into the list indexed in the variable "sc_list".