In Lua there's only string.find
, but sometime string.rfind
is needed. For example, to parse directory and file path like:
fullpath = "c:/abc/def/test.lua"
pos = string.rfind(fullpath,'/')
dir = string.sub(fullpath,pos)
How to write such string.rfind
?