summaryrefslogtreecommitdiff
path: root/doc/classes
diff options
context:
space:
mode:
authorJuan Linietsky <reduzio@gmail.com>2022-07-29 15:30:52 +0200
committerJuan Linietsky <reduzio@gmail.com>2022-08-01 00:56:59 +0200
commit0dd65378e7594e8916474613116d8df485870710 (patch)
treeba77e856d19325ab1be79c19e18c4650e70de249 /doc/classes
parent6d599ed90b396c264486512d5903c209ce729c76 (diff)
Add support for command-line user arguments.
Implements the standard Unix double dash (--) commandline argument: * Arguments after a double dash (--) are ignored by Godot and stored for the user. * User can access them via `OS.get_cmdline_user_args()` Example: `godot.exe scene_to_run.tscn --fullscreen -- --start-level 2`
Diffstat (limited to 'doc/classes')
-rw-r--r--doc/classes/OS.xml11
1 files changed, 11 insertions, 0 deletions
diff --git a/doc/classes/OS.xml b/doc/classes/OS.xml
index 5473347cb1..49c666ec51 100644
--- a/doc/classes/OS.xml
+++ b/doc/classes/OS.xml
@@ -198,6 +198,17 @@
}
[/csharp]
[/codeblocks]
+ [b]Note:[/b] Passing custom user arguments directly is not recommended, as the engine may discard or modify them. Instead, the best way is to use the standard UNIX double dash ([code]--[/code]) and then pass custom arguments, which the engine itself will ignore. These can be read via [method get_cmdline_user_args].
+ </description>
+ </method>
+ <method name="get_cmdline_user_args">
+ <return type="PackedStringArray" />
+ <description>
+ Similar to [method get_cmdline_args], but this returns the user arguments (any argument passed after the double dash [code]--[/code] argument). These are left untouched by Godot for the user.
+ For example, in the command line below, [code]--fullscreen[/code] will not be returned in [method get_cmdline_user_args] and [code]--level 1[/code] will only be returned in [method get_cmdline_user_args]:
+ [codeblock]
+ godot --fullscreen -- --level 1
+ [/codeblock]
</description>
</method>
<method name="get_config_dir" qualifiers="const">