Returns the offset within a string where the specified substring last occurs.
Syntax
lastIndexOf( string , substring )
string.lastIndexOf( substring )
lastIndexOf( string , substring , index )
string.lastIndexOf( 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 last found.
-1, if not found.
|
Example
if s.lastIndexOf( cmd ) then
break
end
|