Skip to content

Commit a0789aa

Browse files
Update code snippet to Godot 4 (#8114)
* Update code snippet to Godot 4 * Update tutorials/best_practices/godot_notifications.rst --------- Co-authored-by: Max Hilbrunner <[email protected]>
1 parent 8d9aea3 commit a0789aa

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

tutorials/best_practices/godot_notifications.rst

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -177,18 +177,15 @@ instantiation:
177177
# "one" is an "initialized value". These DO NOT trigger the setter.
178178
# If someone set the value as "two" from the Inspector, this would be an
179179
# "exported value". These DO trigger the setter.
180-
export(String) var test = "one" setget set_test
180+
@export var test: String = "one":
181+
set(value):
182+
test = value
183+
print("Setting: ", test)
181184

182185
func _init():
183186
# "three" is an "init assignment value".
184-
# These DO NOT trigger the setter, but...
187+
# Trigger the setter
185188
test = "three"
186-
# These DO trigger the setter. Note the `self` prefix.
187-
self.test = "three"
188-
189-
func set_test(value):
190-
test = value
191-
print("Setting: ", test)
192189

193190
.. code-tab:: csharp
194191

0 commit comments

Comments
 (0)