In order to be able to detect if a lua file fails to compile and get
an informative error message like :
  Error!
  /web/localhost/htdocs/info.lua:174: '=' expected near '+'
instead of :
  Error!
  attempt to call a nil value

I suggest you move the load/pcall function from
lua_vmprep:apl_get_lua_state() to mod_lua:lua_handler() and
mod_lua:lua_request_rec_hook_harness() like in the attached patch.

I haven't yet tested how my patch works with hooks but it seems to be
ok for lua_handler. I am not sure about the lua_gc() in case pcall
fails, it just seem logical and that's how it's done in Lua's lua.c
interpreter.

PS: I wish mod_lua was under a distributed SCM like Git or Mercurial,
it would make things easier for me. It takes me forever to make a
patch and I am not even sure it can be used.

-- 
Bertrand Mansion
Mamasam

Attachment: patch-lua-err.diff
Description: Binary data

Reply via email to