Type Function Library table.* Return value Number Revision Release 2022.3683 Keywords table, array
Returns the integer index of an element within an array, or nil
if the element is not in the array. The search goes through the length of the array as determined by #t
whose value is undefined if there are holes.
This function can not be used to locate a child table/array within the array being searched.
local t = { 1, 3, 5, 7, 9, "a", "b" } print( table.indexOf( t, 9 ) ) --> 5 print( table.indexOf( t, 3 ) ) --> 2 print( table.indexOf( t, "b" ) ) --> 7