It should be enough to just push the error message as part of LUAI_TRY.
With C++ it would be something like:
#define LUAI_TRY(L,c,a) try { a } \
catch(std::exception e) \
{ lua_pushstring(L, e.what()); (c)->status = -1; } \
catch(...) \
{ if ((c)->status == 0) (c)->status = -1; }
--
- tom
telliamed@whoopdedo.org
Thanks for responding! I was having trouble with lua_pushstring not
doing anything for me. I think I finally figured out why.
I needed to change the status code from -1 to either LUA_ERRSYNTAX or
LUA_ERRRUN. Otherwise the string was getting lost. I found those two
cases in luaD_seterrorobj where the comment suggests it expects the
error message on the top.