diff options
author | Hugo Locurcio <hugo.locurcio@hugo.pro> | 2019-12-29 16:39:24 +0100 |
---|---|---|
committer | Hugo Locurcio <hugo.locurcio@hugo.pro> | 2020-01-03 11:41:46 +0100 |
commit | cc626acf45c305ffa1bf98013a6bfcb767d703d4 (patch) | |
tree | e2c1604acb07eefe0aa7a67559832cc56ede6629 /doc/classes | |
parent | 9d3424f61ddd1e6bec78381aa4a0c6acec53d290 (diff) |
Add a shorthand for setting the exit code using `SceneTree::quit()`
This reduces the amount of code required to exit a process with a
non-zero exit code. This pattern is also found in most other
programming languages.
Diffstat (limited to 'doc/classes')
-rw-r--r-- | doc/classes/OS.xml | 1 | ||||
-rw-r--r-- | doc/classes/SceneTree.xml | 4 |
2 files changed, 4 insertions, 1 deletions
diff --git a/doc/classes/OS.xml b/doc/classes/OS.xml index 265e87eba3..22f4dc2d83 100644 --- a/doc/classes/OS.xml +++ b/doc/classes/OS.xml @@ -906,6 +906,7 @@ </member> <member name="exit_code" type="int" setter="set_exit_code" getter="get_exit_code" default="0"> The exit code passed to the OS when the main loop exits. By convention, an exit code of [code]0[/code] indicates success whereas a non-zero exit code indicates an error. For portability reasons, the exit code should be set between 0 and 125 (inclusive). + [b]Note:[/b] This value will be ignored if using [method SceneTree.quit] with an [code]exit_code[/code] argument passed. </member> <member name="keep_screen_on" type="bool" setter="set_keep_screen_on" getter="is_keep_screen_on" default="true"> If [code]true[/code], the engine tries to keep the screen on while the game is running. Useful on mobile. diff --git a/doc/classes/SceneTree.xml b/doc/classes/SceneTree.xml index 0635dd8935..6a4105ca2f 100644 --- a/doc/classes/SceneTree.xml +++ b/doc/classes/SceneTree.xml @@ -185,8 +185,10 @@ <method name="quit"> <return type="void"> </return> + <argument index="0" name="exit_code" type="int" default="-1"> + </argument> <description> - Quits the application. + Quits the application. A process [code]exit_code[/code] can optionally be passed as an argument. If this argument is [code]0[/code] or greater, it will override the [member OS.exit_code] defined before quitting the application. </description> </method> <method name="reload_current_scene"> |