that 3rd argument tells the function string.find where to start the search.
in your first example string.find starts searching from the letter “x” onward. Like XeduR said, you started the search from the second to last character in the string.
aaah, i see! no worries, its a really cool language. you’ll be an expert soon
Well I think it means that it is the first “e” in the last 5 characters of the string “Hello Corona user”. The last five characters of that string are " usEr". It searches only these 5 characters. It ignores all the other characters in “Hello Corona”.
I don’t know if this is what you meant, but this function returns the position of a character from the back:
local function findCharFromBack(string, char)
local foundPosition = 0
local searchPosition = 1
local searching = true
while searching do
local search = string.find(string, char, searchPosition)
if search then
foundPosition = search
searchPosition = search + 1
if searchPosition > #string then searching = false end
else
searching = false
end
end
if foundPosition > 0 then
return foundPosition
else
return nil
end
end