There is only one global Lua State inside mod_lua, this shouldn't be used for communication or other uses. In the next version, for Apache 2.0, there may be multiples Lua States in mod_lua.
LuaHandlers (Lua function that responds to httpd events), have a slightly different Lua envoirement that an empty Lua state. Follows a description of this environment.
STANDARD: base, io, string, math, table, loadlib.
Httpd library is special because it delivers comunication between Lua code and httpd. This library is not loaded automatically, see LuaRequire directive.
The global Lua State should be used with much zeal, cause it can easily knock down the entire httpd server. Therefore it's strongly recommended to run user's code in a sandbox. See sandbox project.
The LuaHandler must follow the model:
function handler(r) -- DO SOME THING return httpd.SOME_STATUS_CODE end
Parameter "r" is a userdata that links to request_rec of httpd. It can be used freely inside the handler. It is not recommended to keep the parameter r in a place for others "consultations" in requests, because it's closed as soon as request in progress is closed. This is due to httpd's responsability of the lifetime of this structure.