ds_list_insert

Inserts the given value to any position in the list.

Syntax:

GML Code Example

ds_list_insert(id, pos, val);


Argument Description
id The id of the list to add to.
pos The position to add the value, where 0 corresponds to the very beginning of the list and the final position is ds_list_size(id)-1.
val The value to add to the list.


Returns: N/A


Description

This function will add the given value into the list at the given position. if the list contains more values after the given position, their position will be shifted up one to make room making the list larger by one.


Example:

GML Code Example

ds_list_insert(list, 9, score);

The above code will add the value stored in the variable "score" into the 10th position of the list indexed by the variable "list" (lists are counted from 0, so a ten value list is numbered from 0 - 9).





No Examples Submitted

Does this page need better examples? Be the first to Submit

No Edits Suggested

Is this page unclear or not descriptive enough? Suggest an edit to the page and with enough upvotes your changes will be made.

No Questions Have Been Ask

Do you have a question about this page? Ask it Here