ds_list_set

Syntax:

ds_list_set(id, pos, val);


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


Returns: N/A


Description

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.


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


Back: DS Lists
Next: ds_list_delete
© Copyright YoYo Games Ltd. 2018 All Rights Reserved