Insert Into List


With this action you can recover the index position of an item within the given list. You supply the variable that stores the list index (as returned by the action Create List) and the value you want to find the index position of within the list, as well as a target variable to store the returned index position for the item (which can be flagged as a temporary local variable to be used until the end of the script or event). When you insert a value into a list, all indices above the given index for inserting will be moved up one, so if you have a list with 4 items in it (index position 0 to 3) and place a new item at index position 2, the previous item 2 will become item 3 and the previous item 3 will become item 4. Note that if the value you are looking for does not exist within the list, then there will be no list index position to return, and so the return value will be -1.

Action Syntax:

Insert Into List Syntax


Argument Description
List The index (stored in a variable) of the list to insert into
Index The index position within the list to insert a value
Value The value to be stored at the position


Insert Into List Example
The above action block code uses a repeat loop to get the size of the list then generate a random position within the list. It then generates a random value and inserts this value into the list at the random position defined previously.