MCPcopy Create free account
hub / github.com/StrongPC123/Far-Cry-1-Source-Full / ErrorHandler

Method ErrorHandler

CryScriptSystem/ScriptSystem.cpp:497–529  ·  view source on GitHub ↗

///////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////

Source from the content-addressed store, hash-verified

495//////////////////////////////////////////////////////////////////////
496//////////////////////////////////////////////////////////////////////
497int CScriptSystem::ErrorHandler(lua_State *L)
498{
499 const char *sFuncName = NULL;
500 const char *sSourceFile = NULL;
501 lua_Debug ar;
502 int nRes;
503 int iCurrentLine=-1; // no line number info
504 CScriptSystem *pThis = (CScriptSystem *)lua_touserdata(L, - 1);
505
506 memset(&ar,0,sizeof(lua_Debug));
507
508 lua_pop(L, 1);
509 if (lua_isstring(L, 1))
510 {
511 const char *sErr = lua_tostring(L, 1);
512 nRes = lua_getstack(L, 1, &ar);
513
514 if (nRes != 0)
515 {
516 nRes = lua_getinfo(L, "lnS", &ar);
517 iCurrentLine=ar.currentline;
518 sFuncName = ar.name;
519 sSourceFile = ar.source;
520 }
521 if (!sFuncName)
522 sFuncName = "undefined";
523 if (!sSourceFile)
524 sSourceFile= "undefined";
525
526 pThis->m_pSink->OnScriptError(sSourceFile, sFuncName, iCurrentLine, sErr);
527 }
528 return 0;
529}
530
531//////////////////////////////////////////////////////////////////////
532//////////////////////////////////////////////////////////////////////

Callers

nothing calls this directly

Calls 6

lua_touserdataFunction · 0.85
lua_isstringFunction · 0.85
lua_tostringFunction · 0.85
lua_getstackFunction · 0.85
lua_getinfoFunction · 0.85
OnScriptErrorMethod · 0.80

Tested by

no test coverage detected