Name
InsertItem -- insert item into a list (V2.0)
Synopsis
InsertItem(array, item[, pos])
Function
This function inserts the specified item into the specified array. Item can be of any type. If you do not specify the optional argument pos, the item will be appended to the end of the list. If you specify the pos argument, the item will be inserted at this position and all succeeding items will be moved one position up. Position counter starts at 0 which is the first element.

Inputs
array
table where to insert the element
item
item to insert (can be of any type)
pos
optional: where to insert (defaults to -1 which means at the end of the list)
Example
a = {1, 2, 3, 4, 5, 7, 8, 9, 10}
InsertItem(a, 6, 5)
For k = 1 To ListItems(a) Do Print(a[k - 1] .. " ")
Prints "1 2 3 4 5 6 7 8 9 10". The item "6" is inserted at position 5 so that the row is complete.

Show TOC