diff options
| author | Rémi Verschelde <rverschelde@gmail.com> | 2023-02-07 19:38:21 +0100 |
|---|---|---|
| committer | Rémi Verschelde <rverschelde@gmail.com> | 2023-02-07 19:38:21 +0100 |
| commit | bd267c911b765b0f2290c744a0ca0d8e72806f58 (patch) | |
| tree | 317868eb902826463d28cfd51dc664ddf25146c5 /modules/gdscript/doc_classes/@GDScript.xml | |
| parent | 3f95b39cb3a17e25d0344e986c6bd5c69443b4b5 (diff) | |
| parent | c8e3d8b5d5d4e82c4337ae150560615bfc38850c (diff) | |
Merge pull request #72493 from dalexeev/gds-export-flags
GDScript: Improve validation and documentation of `@export_flags`
Diffstat (limited to 'modules/gdscript/doc_classes/@GDScript.xml')
| -rw-r--r-- | modules/gdscript/doc_classes/@GDScript.xml | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/modules/gdscript/doc_classes/@GDScript.xml b/modules/gdscript/doc_classes/@GDScript.xml index e05b17168d..923b2fe30d 100644 --- a/modules/gdscript/doc_classes/@GDScript.xml +++ b/modules/gdscript/doc_classes/@GDScript.xml @@ -304,7 +304,7 @@ <return type="void" /> <param index="0" name="names" type="String" /> <description> - Export an [int] or [String] property as an enumerated list of options. If the property is an [int], then the index of the value is stored, in the same order the values are provided. You can add specific identifiers for allowed values using a colon. If the property is a [String], then the value is stored. + Export an [int] or [String] property as an enumerated list of options. If the property is an [int], then the index of the value is stored, in the same order the values are provided. You can add explicit values using a colon. If the property is a [String], then the value is stored. See also [constant PROPERTY_HINT_ENUM]. [codeblock] @export_enum("Warrior", "Magician", "Thief") var character_class: int @@ -357,6 +357,20 @@ [codeblock] @export_flags("Fire", "Water", "Earth", "Wind") var spell_elements = 0 [/codeblock] + You can add explicit values using a colon: + [codeblock] + @export_flags("Self:4", "Allies:8", "Foes:16") var spell_targets = 0 + [/codeblock] + You can also combine several flags: + [codeblock] + @export_flags("Self:4", "Allies:8", "Self and Allies:12", "Foes:16") + var spell_targets = 0 + [/codeblock] + [b]Note:[/b] A flag value must be at least [code]1[/code] and at most [code]2 ** 32 - 1[/code]. + [b]Note:[/b] Unlike [annotation @export_enum], the previous explicit value is not taken into account. In the following example, A is 16, B is 2, C is 4. + [codeblock] + @export_flags("A:16", "B", "C") var x + [/codeblock] </description> </annotation> <annotation name="@export_flags_2d_navigation"> |