string.math and 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.lua example included in the appendix allows a large file to be accessed via an array interface, which can then be matched by these string.find/string.match functions, 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