ForEachI -- iterate over all integer indices of a table (V5.0)
[v] = ForEachI(table, func[, userdata])
This function can be used to iterate over all integer indices of the table specified in the first argument. For each table element at an integer index this command will call the user function specified in func. The user function will receive two arguments: The first argument will contain the index of the table element, whereas the second argument will contain the value at that index. If the user function returns a value the loop is broken, and this value is returned as the result from ForEachI().

Please note that this function will traverse only integer indices. If you would like to iterate over the whole table, use the ForEach() command instead. See ForEach for details.

Starting with Hollywood 6.1 this function accepts an optional userdata parameter. The value you pass here will be forwarded to your callback as the third function parameter. The value can be of any type.

table that should be traversed
user function to call for each integer index
optional: user data to pass to callback function (V6.1)
optional: return value if iteration is broken by user function (see above)
t = {1, 2, 3, 4, Test$="Hello", Value=9.2}
ForEachI(t, DebugPrint)
The code above dumps only the integer indices of table 't'. This means that the indices Test$ and Value won't be respected.

Show TOC