Insert
From Original War Support Wiki
SAIL Functions/I -> Insert
Contents |
Description
Function Insert inserts the specified value (or list) the specified place in the specified list. Returns the modified list.
Template
Insert(list, index_number, new_value);
list - The list you want to add a value to
index_number - An integer defining where in the specified list you want to place the new value
new_value - The value you want to add
Example
Export the_list;
Every 0$1 do
begin
the_list = [5,8,23,11];
Wait(0$3);
the_list = Insert(the_list,3,77);
end;
Now "the_list" holds the following list: [5,8,77,23,11]
An alternative
Alternatively you can use "^" to add a value to a list (you can't add lists to lists in this way, though). The value will be placed in continuation of the targeted list.
Export another_list;
Every 0$3 do
begin
another_list = [4,2,5];
Wait(0$1);
another_list = another_list^7;
end;
Now "another_list" holds this list: [4,2,5,7]




