fork from http://lua.sqlite.org