MCPcopy Create free account
hub / github.com/DFHack/dfhack / dfhack_error

Function dfhack_error

library/LuaTools.cpp:672–693  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

670}
671
672static int dfhack_error(lua_State *L)
673{
674 luaL_checkany(L, 1);
675 lua_settop(L, 3);
676 int level = std::max(1, luaL_optint(L, 2, 1));
677
678 lua_pushvalue(L, 1);
679
680 if (convert_to_exception(L, level))
681 {
682 luaL_where(L, level);
683 lua_setfield(L, -2, "where");
684
685 if (!lua_isnil(L, 3))
686 {
687 lua_pushvalue(L, 3);
688 lua_setfield(L, -2, "verbose");
689 }
690 }
691
692 return lua_error(L);
693}
694
695// replaces os.exit with a thrown exception
696static int dfhack_exit_error(lua_State *L)

Callers 1

dfhack_exit_errorFunction · 0.85

Calls 7

luaL_checkanyFunction · 0.85
lua_settopFunction · 0.85
lua_pushvalueFunction · 0.85
convert_to_exceptionFunction · 0.85
luaL_whereFunction · 0.85
lua_setfieldFunction · 0.85
lua_errorFunction · 0.85

Tested by

no test coverage detected