Simplify. RageException::Throw no longer actually throws; this makes
debugging much easier, since we don't lose the stack after a Lua error.
This commit is contained in:
@@ -106,20 +106,12 @@ void LuaManager::SetGlobal( const CString &sName )
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static jmp_buf jbuf;
|
|
||||||
static CString jbuf_error;
|
|
||||||
|
|
||||||
static int LuaPanic( lua_State *L )
|
static int LuaPanic( lua_State *L )
|
||||||
{
|
{
|
||||||
CString err;
|
CString sErr;
|
||||||
LUA->PopStack( err );
|
LUA->PopStack( sErr );
|
||||||
|
|
||||||
/* Grr. We can't throw an exception from here: it'll explode going through the
|
RageException::Throw( "%s", sErr.c_str() );
|
||||||
* 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 );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -143,8 +135,6 @@ LuaManager::LuaManager()
|
|||||||
{
|
{
|
||||||
LUA = this; // so that LUA is available when we call the Register functions
|
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;
|
L = NULL;
|
||||||
|
|
||||||
ResetState();
|
ResetState();
|
||||||
|
|||||||
Reference in New Issue
Block a user