Created
April 9, 2013 16:01
-
-
Save cristobal/5346946 to your computer and use it in GitHub Desktop.
Lua variant for the php strpos function
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function strpos (haystack, needle, offset) | |
local pattern = string.format("(%s)", needle) | |
local i = string.find (haystack, pattern, (offset or 0)) | |
return (i ~= nil and i or false) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment