Fix GDScript enum docs for 3.1

This commit is contained in:
Rémi Verschelde
2019-01-28 12:05:20 +01:00
parent 71c39d2031
commit a30183a4c4

View File

@@ -658,8 +658,12 @@ Enums
Enums are basically a shorthand for constants, and are pretty useful if you
want to assign consecutive integers to some constant.
If you pass a name to the enum, it would also put all the values inside a
constant dictionary of that name.
If you pass a name to the enum, it will put all the keys inside a constant
dictionary of that name.
.. important: The keys in a named enum are not registered as global constants
in Godot 3.1 and later, they should be accessed prefixed by the
enum's name (``Name.KEY``). See example below.
::
@@ -672,10 +676,8 @@ constant dictionary of that name.
enum State {STATE_IDLE, STATE_JUMP = 5, STATE_SHOOT}
# Is the same as:
const STATE_IDLE = 0
const STATE_JUMP = 5
const STATE_SHOOT = 6
const State = {STATE_IDLE = 0, STATE_JUMP = 5, STATE_SHOOT = 6}
# Access values with State.STATE_IDLE, etc.
Functions