From 703833d7d4ed5980f8ff93bb8ba7a69a34cf071b Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Fri, 28 Jan 2005 19:42:44 +0000 Subject: [PATCH] Simplify. RageException::Throw no longer actually throws; this makes debugging much easier, since we don't lose the stack after a Lua error. --- stepmania/src/LuaManager.cpp | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/stepmania/src/LuaManager.cpp b/stepmania/src/LuaManager.cpp index cd313f02a5..afec506638 100644 --- a/stepmania/src/LuaManager.cpp +++ b/stepmania/src/LuaManager.cpp @@ -106,20 +106,12 @@ void LuaManager::SetGlobal( const CString &sName ) } - -static jmp_buf jbuf; -static CString jbuf_error; - static int LuaPanic( lua_State *L ) { - CString err; - LUA->PopStack( err ); + CString sErr; + LUA->PopStack( sErr ); - /* Grr. We can't throw an exception from here: it'll explode going through the - * Lua stack for some reason. Get it off the stack with a longjmp and throw - * an exception from there. */ - jbuf_error = err; - longjmp( jbuf, 1 ); + RageException::Throw( "%s", sErr.c_str() ); } @@ -143,8 +135,6 @@ LuaManager::LuaManager() { LUA = this; // so that LUA is available when we call the Register functions - if( setjmp(jbuf) ) - RageException::Throw("%s", jbuf_error.c_str()); L = NULL; ResetState();