From Spherical
Jump to: navigation, search

Exits the game, just like Exit(). The big difference is that you can pass a custom error message which shows when you exit the game using this function.



  • error_message String. The message you would like to show when exiting the game. The message is shown in the Sphere display using the default system font.


var stopped = 12;
Abort("Stopped the engine, code " + stopped + ".");

Aborts with the message "Stopped the engine, code 12." with Sphere error text containing the file and line number where Abort was called.

Abort("Well, thanks for playing.\n");

Shows the text "Well, thanks for playing" and then exits the engine. Due to the trailing newline character (i.e. '\n'), the extra error text Sphere normally displays is not shown.


This function is useful for debugging and checking if a value was correct or wrong, or if an exception was found in the engine (like doing something that is not allowed).

Setting the last character to be the newline character '\n' (see second example) will stop Sphere from displaying its own error information. This is an easy way to end the game with a message.

See also