Name
RemoveItem -- remove item from a list (V2.0)
Synopsis
e = RemoveItem(list[, pos])
Function
This function removes an item from the list specified by list and returns it. If you omit the optional argument pos, the last item of the list will be removed. Otherwise the specified item is removed. Position 0 specifies the first item of the list. After removing the item, the list is reorganized to close the gap.

Note that this function is rather slow when used with normal Hollywood tables. To accelerate RemoveItem(), you have to use it with optimized lists created by CreateList(). See CreateList for details.

Inputs
list
table from where to remove the element
pos
optional: item that is to be removed (defaults to -1 which means that the last element should be removed)
Results
e
the item that was just removed
Example
a = {1, 2, 3, 4, 5, 6, 7, 8, 8, 9, 10}
e = RemoveItem(a, 7)
For k = 1 To ListItems(a) Do Print(a[k - 1] .. " ")
Removes the number 8 because it is twice in the list. The variable e will receive the value 8. After removing the item, the correct row will be printed: "1 2 3 4 5 6 7 8 9 10".

Show TOC