//----------------------------------------------------------------//
void MOAIHarness::HandleError(const char* message, lua_State* L, int level)
{
    if (MOAIHarness::mSocketID == -1)
    {
        ZLLog::LogF ( "%s\n", message );
        MOAIScopedLuaState state ( L );
        state.PrintStackTrace ( ZLLog::CONSOLE, NULL, level );
    }
    else
    {
        // Package the call stack into a json object
    	json_t* stack = ConvertCallStackToJSON(L, 0);
        MOAIHarness::SendError(message, stack, level);
        MOAIHarness::Pause(L);
    }
}
Exemple #2
0
//----------------------------------------------------------------//
int MOAILuaRuntime::_traceback ( lua_State *L ) {

	MOAILuaState state ( L );
		
	cc8* msg = NULL;
	if ( lua_isstring ( L, 1 )) {  // 'message' a string?
		msg = lua_tostring ( L, 1 );
	}
	
	TracebackFunc tracebackFunc = MOAILuaRuntime::Get ().mTracebackFunc;
	if ( tracebackFunc ) {
		tracebackFunc ( msg, L, 0 );
	}
	else {
		if ( msg ) {
			ZLLog::Print ( "%s\n", msg );
		}
		MOAIScopedLuaState state ( L );
		state.PrintStackTrace ( ZLLog::CONSOLE, 0 );
	}
	return 0;
}