tutorials/scripting/gdscript/gdscript_basics #61
Replies: 6 comments 9 replies
-
Is there a concept of "generators" in gdscript? For example: for obj in compute_a_long_list():
do_something(obj)
func compute_a_long_list():
# in c# it would be yield return 1
# yield return obj1
# yield return obj2
# etc... |
Beta Was this translation helpful? Give feedback.
-
4.3 introduced PackedVector4 |
Beta Was this translation helpful? Give feedback.
-
Is there a way to use
|
Beta Was this translation helpful? Give feedback.
-
Since typed dictionaries are introduced in 4.4, a new section similar to "Typed Arrays" should be added for "Dictionary" section. |
Beta Was this translation helpful? Give feedback.
-
On property getters, does a property run its getter each time the property appears, or is the property's calculation cached? Silly example: var my_var : int:
get = expensive_function
func expensive_function():
# Does a lot of stuff
func my_function():
var new_int := 0
for x in big_number:
new_int += my_var # does this call the getter each time?
new_int += my_var + 1 # or is it cached for future lines?
new_int += my_var + 2
return new_int |
Beta Was this translation helpful? Give feedback.
-
On the warning about lambdas, is the third code block not just repeating the second, failing to actually represent the difference in variants outside of the lambda's scope that are pass-by-reference data types? |
Beta Was this translation helpful? Give feedback.
-
tutorials/scripting/gdscript/gdscript_basics
GDScript is a high-level, object-oriented, imperative, and gradually typed programming language built for Godot. It uses an indentation-based syntax similar to languages like Python. Its goal is to...
https://docs.godotengine.org/en/stable/tutorials/scripting/gdscript/gdscript_basics.html
Beta Was this translation helpful? Give feedback.
All reactions