Add fill method to Arrays and PackedArrays
This commit is contained in:
@@ -237,6 +237,27 @@
|
||||
[b]Note:[/b] On large arrays, this method will be slower if the removed element is close to the beginning of the array (index 0). This is because all elements placed after the removed element have to be reindexed.
|
||||
</description>
|
||||
</method>
|
||||
<method name="fill">
|
||||
<return type="void">
|
||||
</return>
|
||||
<argument index="0" name="value" type="Variant">
|
||||
</argument>
|
||||
<description>
|
||||
Assigns the given value to all elements in the array. This can typically be used together with [method resize] to create an array with a given size and initialized elements:
|
||||
[codeblocks]
|
||||
[gdscript]
|
||||
var array = []
|
||||
array.resize(10)
|
||||
array.fill(0) # Initialize the 10 elements to 0.
|
||||
[/gdscript]
|
||||
[csharp]
|
||||
var array = new Godot.Collections.Array{};
|
||||
array.Resize(10);
|
||||
array.Fill(0); // Initialize the 10 elements to 0.
|
||||
[/csharp]
|
||||
[/codeblocks]
|
||||
</description>
|
||||
</method>
|
||||
<method name="find" qualifiers="const">
|
||||
<return type="int">
|
||||
</return>
|
||||
|
||||
Reference in New Issue
Block a user