feat: updated engine
This commit is contained in:
parent
cbe99774ff
commit
f4cf6b3999
6607 changed files with 910135 additions and 430025 deletions
|
|
@ -37,6 +37,7 @@
|
|||
[/codeblocks]
|
||||
[b]Note:[/b] Arrays are always passed by [b]reference[/b]. To get a copy of an array that can be modified independently of the original array, use [method duplicate].
|
||||
[b]Note:[/b] Erasing elements while iterating over arrays is [b]not[/b] supported and will result in unpredictable behavior.
|
||||
[b]Note:[/b] In a boolean context, an array will evaluate to [code]false[/code] if it's empty ([code][][/code]). Otherwise, an array will always evaluate to [code]true[/code].
|
||||
[b]Differences between packed arrays, typed arrays, and untyped arrays:[/b] Packed arrays are generally faster to iterate on and modify compared to a typed array of the same type (e.g. [PackedInt64Array] versus [code]Array[int][/code]). Also, packed arrays consume less memory. As a downside, packed arrays are less flexible as they don't offer as many convenience methods such as [method Array.map]. Typed arrays are in turn faster to iterate on and modify than untyped arrays.
|
||||
</description>
|
||||
<tutorials>
|
||||
|
|
@ -192,16 +193,16 @@
|
|||
public override void _Ready()
|
||||
{
|
||||
// Prints True (3/3 elements evaluate to true).
|
||||
GD.Print(new Godot.Collections.Array>int< { 6, 10, 6 }.All(GreaterThan5));
|
||||
GD.Print(new Godot.Collections.Array<int> { 6, 10, 6 }.All(GreaterThan5));
|
||||
// Prints False (1/3 elements evaluate to true).
|
||||
GD.Print(new Godot.Collections.Array>int< { 4, 10, 4 }.All(GreaterThan5));
|
||||
GD.Print(new Godot.Collections.Array<int> { 4, 10, 4 }.All(GreaterThan5));
|
||||
// Prints False (0/3 elements evaluate to true).
|
||||
GD.Print(new Godot.Collections.Array>int< { 4, 4, 4 }.All(GreaterThan5));
|
||||
GD.Print(new Godot.Collections.Array<int> { 4, 4, 4 }.All(GreaterThan5));
|
||||
// Prints True (0/0 elements evaluate to true).
|
||||
GD.Print(new Godot.Collections.Array>int< { }.All(GreaterThan5));
|
||||
GD.Print(new Godot.Collections.Array<int> { }.All(GreaterThan5));
|
||||
|
||||
// Same as the first line above, but using a lambda function.
|
||||
GD.Print(new Godot.Collections.Array>int< { 6, 10, 6 }.All(element => element > 5)); // Prints True
|
||||
GD.Print(new Godot.Collections.Array<int> { 6, 10, 6 }.All(element => element > 5)); // Prints True
|
||||
}
|
||||
[/csharp]
|
||||
[/codeblocks]
|
||||
|
|
@ -428,6 +429,13 @@
|
|||
|
||||
func _ready():
|
||||
print([1, 3, 4, 7].find_custom(is_even.bind())) # Prints 2
|
||||
|
||||
# Another example using `bind()` to pass an additional parameter:
|
||||
func is_specific_number(number, expected):
|
||||
return number == expected
|
||||
|
||||
func _ready():
|
||||
print([1, 3, 4, 7].find_custom(is_specific_number.bind(4))) # Prints 2
|
||||
[/gdscript]
|
||||
[/codeblocks]
|
||||
</description>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue