string.find) in Lua. This is a fairly direct port of [lstrlib.c] to Lua.
Reimplementing these in Lua provides a number of generalizations and possible applications:
filearray.luaexample included in the appendix allows a large file to be accessed via an array interface, which can then be matched by these
string.matchfunctions, without ever loading the entire file into memory at once.
A few examples are given in the test suite (test.lua).
source code: https://github.com/davidm/lua-stringlua