MCPcopy Create free account
hub / github.com/defold/defold / Sys_Exit

Function Sys_Exit

engine/script/src/script_sys.cpp:1242–1256  ·  view source on GitHub ↗

exits application * Terminates the game application and reports the specified code to the OS. * * @name sys.exit * @param code [type:number] exit code to report to the OS, 0 means clean exit * @examples * * This examples demonstrates how to exit the application when some kind of quit messages is received (maybe from gui or similar): * * ```lua *

Source from the content-addressed store, hash-verified

1240 * ```
1241 */
1242 static int Sys_Exit(lua_State* L)
1243 {
1244 DM_LUA_STACK_CHECK(L, 0);
1245
1246 dmSystemDDF::Exit msg;
1247 msg.m_Code = luaL_checkinteger(L, 1);
1248
1249 dmMessage::URL url;
1250 GetSystemURL(&url);
1251
1252 dmMessage::Result result = dmMessage::Post(0, &url, dmSystemDDF::Exit::m_DDFDescriptor->m_NameHash, 0, (uintptr_t) dmSystemDDF::Exit::m_DDFDescriptor, &msg, sizeof(msg), 0);
1253 assert(result == dmMessage::RESULT_OK);
1254
1255 return 0;
1256 }
1257
1258 /*# reboot engine with arguments
1259 * Reboots the game engine with a specified set of arguments.

Callers

nothing calls this directly

Calls 4

luaL_checkintegerFunction · 0.85
GetSystemURLFunction · 0.85
PostFunction · 0.50
assertFunction · 0.50

Tested by

no test coverage detected