mirror of
https://github.com/godotengine/godot.git
synced 2026-01-05 06:11:29 +03:00
Add fill method to Array and PoolArrays
Co-authored-by: Matheus Lima Cunha <matheus.limacunha@hotmail.com>
This commit is contained in:
@@ -177,6 +177,17 @@
|
||||
[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">
|
||||
<argument index="0" name="value" type="Variant" />
|
||||
<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:
|
||||
[codeblock]
|
||||
var array = []
|
||||
array.resize(10)
|
||||
array.fill(0) # Initialize the 10 elements to 0.
|
||||
[/codeblock]
|
||||
</description>
|
||||
</method>
|
||||
<method name="find">
|
||||
<return type="int" />
|
||||
<argument index="0" name="what" type="Variant" />
|
||||
|
||||
Reference in New Issue
Block a user