First step in making Lua use exceptions properly
This commit is contained in:
@@ -50,9 +50,12 @@
|
|||||||
|
|
||||||
#if defined(__cplusplus) && !defined(LUA_USE_LONGJMP)
|
#if defined(__cplusplus) && !defined(LUA_USE_LONGJMP)
|
||||||
/* C++ exceptions */
|
/* 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) \
|
#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 */
|
#define luai_jmpbuf int /* dummy variable */
|
||||||
|
|
||||||
#elif defined(LUA_USE_ULONGJMP)
|
#elif defined(LUA_USE_ULONGJMP)
|
||||||
|
|||||||
Reference in New Issue
Block a user