Returns the offset within a string where the specified substring first occurs.
Syntax
index( string , substring )
string.index( substring )
index( string , substring , index )
string.index( substring , index )
Parameters
string
|
the string to check.
|
substring
|
the substring to check for.
|
index
|
the starting index into the specified string.
|
Returns
integer
|
index into the string where the substring was found.
-1, if not found.
|
Example
if s.index( cmd ) then
break
end
|