GDScript: Allow constant expressions in annotations

This commit is contained in:
Danil Alexeev
2023-01-18 20:12:33 +03:00
parent e93266b9ff
commit b004f8180e
23 changed files with 158 additions and 190 deletions

View File

@ -42,7 +42,7 @@
You can access a dictionary's value by referencing its corresponding key. In the above example, [code]points_dict["White"][/code] will return [code]50[/code]. You can also write [code]points_dict.White[/code], which is equivalent. However, you'll have to use the bracket syntax if the key you're accessing the dictionary with isn't a fixed string (such as a number or variable).
[codeblocks]
[gdscript]
@export(String, "White", "Yellow", "Orange") var my_color
@export_enum("White", "Yellow", "Orange") var my_color: String
var points_dict = {"White": 50, "Yellow": 75, "Orange": 100}
func _ready():
# We can't use dot syntax here as `my_color` is a variable.