Type Function Library table.* Return value Number Revision 2017.3060 Keywords table, array
Returns the integer index of element in array t. Returns nil if not in array. The search goes through the length of the array as determined by #t, whose value is undefined if there are holes.
table.indexOf( t, element )
Array. The array to be searched.
Any. The element in the array.
local t = {1,3,5,7,9}
print( table.indexOf( t, 9 ) ) -- output: 5