Would there be some lua_State trickery to uniquely identify where luaL_error() was called from? Maybe some twisted native (machine language) stack walk? The daemon currently uses wxWidgets (base) so can use x-platform functions.
Well, again, if the goal is to support a wide range of different Lua VM's, I think you'd need several different versions of this black magic; at least one for each major release of Lua and LuaJIT. Pattern matching is probably both easier and more robust that trying something like this.
If you don't care so much about broad VM support, then I think you're back to having an extended error info patch be your best option.
-Sven