First step in making Lua use exceptions properly

This commit is contained in:
2023-04-04 15:50:06 -04:00
parent bee43ebbd2
commit cb370239d5

View File

@@ -50,9 +50,12 @@
#if defined(__cplusplus) && !defined(LUA_USE_LONGJMP)
/* C++ exceptions */
#define LUAI_THROW(L,c) throw(c)
class LuaException {};
#define LUAI_THROW(L,c) throw(LuaException())
// Do not call the lua interpreter inside a try-catch block. If you do,
// the intepreter state could be corrupted.
#define LUAI_TRY(L,c,a) \
try { a } catch(...) { if ((c)->status == 0) (c)->status = -1; }
try { a } catch(LuaException e) { if ((c)->status == 0) (c)->status = -1; }
#define luai_jmpbuf int /* dummy variable */
#elif defined(LUA_USE_ULONGJMP)