From: mfranz Date: Fri, 27 Jan 2006 19:51:25 +0000 (+0000) Subject: we need a way to specify other contexts than _context; idea & OK by Andy X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=32968d81f3a815c4a7998d708d6171373b8f76ff;p=flightgear.git we need a way to specify other contexts than _context; idea & OK by Andy --- diff --git a/src/Scripting/NasalSys.cxx b/src/Scripting/NasalSys.cxx index 6b30376e3..9447f90be 100644 --- a/src/Scripting/NasalSys.cxx +++ b/src/Scripting/NasalSys.cxx @@ -75,7 +75,7 @@ bool FGNasalSys::parseAndRun(const char* sourceCode) naCall(_context, code, 0, 0, naNil(), naNil()); if(!naGetError(_context)) return true; - logError(); + logError(_context); return false; } @@ -443,17 +443,17 @@ void FGNasalSys::loadPropertyScripts() } // Logs a runtime error, with stack trace, to the FlightGear log stream -void FGNasalSys::logError() +void FGNasalSys::logError(naContext context) { SG_LOG(SG_NASAL, SG_ALERT, - "Nasal runtime error: " << naGetError(_context)); + "Nasal runtime error: " << naGetError(context)); SG_LOG(SG_NASAL, SG_ALERT, - " at " << naStr_data(naGetSourceFile(_context, 0)) << - ", line " << naGetLine(_context, 0)); - for(int i=1; ihandler, 0, 0, naNil(), naNil()); if(naGetError(_context)) - logError(); + logError(_context); gcRelease(t->gcKey); } diff --git a/src/Scripting/NasalSys.hxx b/src/Scripting/NasalSys.hxx index 41e3d96ef..0a13f1212 100644 --- a/src/Scripting/NasalSys.hxx +++ b/src/Scripting/NasalSys.hxx @@ -68,7 +68,7 @@ private: void loadPropertyScripts(); void hashset(naRef hash, const char* key, naRef val); - void logError(); + void logError(naContext); naRef parse(const char* filename, const char* buf, int len); naRef genPropsModule(); naRef propNodeGhost(SGPropertyNode* handle); @@ -120,7 +120,7 @@ public: naContext subc = naNewContext(); naCall(subc, _handler, 0, 0, naNil(), naNil()); if(naGetError(subc)) - _nas->logError(); + _nas->logError(subc); naFreeContext(subc); }