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

Function do_invoke_cleanup

library/LuaTools.cpp:1311–1328  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1309}
1310
1311static bool do_invoke_cleanup(lua_State *L, int nargs, int errorfun, bool success)
1312{
1313 bool ok = lua_pcall(L, nargs, 0, errorfun) == LUA_OK;
1314
1315 if (!ok)
1316 {
1317 // If finalization failed, attach the previous error
1318 if (lua_istable(L, -1) && !success)
1319 {
1320 lua_swap(L);
1321 lua_setfield(L, -2, "cause");
1322 }
1323
1324 success = false;
1325 }
1326
1327 return success;
1328}
1329
1330int dfhack_cleanup_cont(lua_State *L, int status, lua_KContext)
1331{

Callers 2

dfhack_cleanup_contFunction · 0.85

Calls 2

lua_swapFunction · 0.85
lua_setfieldFunction · 0.85

Tested by

no test coverage detected