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

Function os_exit

depends/lua/src/loslib.c:373–383  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

371
372
373static int os_exit (lua_State *L) {
374 int status;
375 if (lua_isboolean(L, 1))
376 status = (lua_toboolean(L, 1) ? EXIT_SUCCESS : EXIT_FAILURE);
377 else
378 status = (int)luaL_optinteger(L, 1, EXIT_SUCCESS);
379 if (lua_toboolean(L, 2))
380 lua_close(L);
381 if (L) exit(status); /* 'if' to avoid warnings for unreachable 'return' */
382 return 0;
383}
384
385
386static const luaL_Reg syslib[] = {

Callers

nothing calls this directly

Calls 3

lua_tobooleanFunction · 0.85
luaL_optintegerFunction · 0.85
lua_closeFunction · 0.85

Tested by

no test coverage detected