diff options
author | Marius Hanl <mariushanl@web.de> | 2022-06-13 23:35:02 +0200 |
---|---|---|
committer | Marius Hanl <mariushanl@web.de> | 2022-12-21 19:49:57 +0100 |
commit | 5aa243f9da1c8ae425ae5b6706fe889f6e301959 (patch) | |
tree | c5294bbef0a1fe0897eddfbb41e7f5687a29466b /doc | |
parent | dcb3754db09b7b8c35aae1fedbc485b91e9f9508 (diff) |
Added the possibility to define a default value in ProjectSettings.get_setting(), which is used when no setting is set.
Also added tests for the project settings.
Co-authored-by: Yuri Sizov <11782833+YuriSizov@users.noreply.github.com>
Diffstat (limited to 'doc')
-rw-r--r-- | doc/classes/ProjectSettings.xml | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/doc/classes/ProjectSettings.xml b/doc/classes/ProjectSettings.xml index b80d6b2216..67b692a7a0 100644 --- a/doc/classes/ProjectSettings.xml +++ b/doc/classes/ProjectSettings.xml @@ -70,15 +70,18 @@ <method name="get_setting" qualifiers="const"> <return type="Variant" /> <param index="0" name="name" type="String" /> + <param index="1" name="default_value" type="Variant" default="null" /> <description> - Returns the value of a setting. + Returns the value of the setting identified by [param name]. If the setting doesn't exist and [param default_value] is specified, the value of [param default_value] is returned. Otherwise, [code]null[/code] is returned. [b]Example:[/b] [codeblocks] [gdscript] print(ProjectSettings.get_setting("application/config/name")) + print(ProjectSettings.get_setting("application/config/custom_description", "No description specified.")) [/gdscript] [csharp] GD.Print(ProjectSettings.GetSetting("application/config/name")); + GD.Print(ProjectSettings.GetSetting("application/config/custom_description", "No description specified.")); [/csharp] [/codeblocks] </description> |