MCPcopy Create free account
hub / github.com/OGSR/OGSR-Engine / print_output

Method print_output

ogsr_engine/COMMON_AI/script_engine.cpp:750–783  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

748}
749
750bool CScriptEngine::print_output(lua_State* L, const char* caScriptFileName,
751 int errorCode) // KRodin: вызывается из нескольких мест, в т.ч. из калбеков lua_error, lua_pcall_failed, lua_cast_failed, lua_panic
752{
753 auto Prefix = "";
754 if (errorCode)
755 {
756 switch (errorCode)
757 {
758 case LUA_ERRRUN: Prefix = "SCRIPT RUNTIME ERROR"; break;
759 case LUA_ERRMEM: Prefix = "SCRIPT ERROR (memory allocation)"; break;
760 case LUA_ERRERR: Prefix = "SCRIPT ERROR (while running the error handler function)"; break;
761 case LUA_ERRFILE: Prefix = "SCRIPT ERROR (while running file)"; break;
762 case LUA_ERRSYNTAX: Prefix = "SCRIPT SYNTAX ERROR"; break;
763 case LUA_YIELD: Prefix = "Thread is yielded"; break;
764 default: NODEFAULT;
765 }
766 }
767
768 auto traceback = get_lua_traceback(L);
769
770 if (!lua_isstring(L, -1)) // НЕ УДАЛЯТЬ! Иначе будут вылeты без лога!
771 {
772 Msg("*********************************************************************************");
773 Msg("[print_output(%s)] %s!\n%s", caScriptFileName, Prefix, traceback);
774 Msg("*********************************************************************************");
775 return false;
776 }
777
778 auto S = lua_tostring(L, -1);
779 Msg("*********************************************************************************");
780 Msg("[print_output(%s)] %s:\n%s\n%s", caScriptFileName, Prefix, S, traceback);
781 Msg("*********************************************************************************");
782 return true;
783}

Callers

nothing calls this directly

Calls 3

MsgFunction · 0.85
get_lua_tracebackFunction · 0.70
lua_isstringFunction · 0.50

Tested by

no test coverage detected