[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: fine-grained lua_pcall() error processing
- From: petah <lua@...>
- Date: Tue, 12 Mar 2013 00:53:38 +0100
I need to add some "intelligence" to a Lua error handler (written in C++), f.ex. taking specific action on a missing require() (which throws LUA_ERRRUN, not LUA_ERRFILE) when remote-debugging from a client with a case-insensitive filesystem to a daemon that's not. Or suggesting fixes on a malformed regex, etc. There are only a handful of LUA_ERR consts but dozens of different (yet finite) luaL_error() messages.
Is it possible to get more structured information from a Lua error callback than a "mangled" string generated by luaL_error()/lua_error()?
If not, is there a less dicey way to reduce an error string to a discrete enum than cascading if/else regexes?
If not, is there code out there (whatever the language) to extract a robust regex mapping table from the Lua VM source code?
My debugger is C-only (no extraneous Lua) and I'd really like to avoid patching the Lua VM.