Skip to content

Instantly share code, notes, and snippets.

@cristobal
Created April 9, 2013 16:01
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cristobal/5346946 to your computer and use it in GitHub Desktop.
Save cristobal/5346946 to your computer and use it in GitHub Desktop.
Lua variant for the php strpos function
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