mirror of
https://github.com/godotengine/godot.git
synced 2026-01-03 18:11:19 +03:00
Add an Array.pop_at() method to pop an element at an arbitrary index
Negative indices are supported to pop an element relative from the end.
This commit is contained in:
@@ -251,6 +251,14 @@
|
||||
Returns the minimum value contained in the array if all elements are of comparable types. If the elements can't be compared, [code]null[/code] is returned.
|
||||
</description>
|
||||
</method>
|
||||
<method name="pop_at">
|
||||
<return type="Variant" />
|
||||
<argument index="0" name="position" type="int" />
|
||||
<description>
|
||||
Removes and returns the element of the array at index [code]position[/code]. If negative, [code]position[/code] is considered relative to the end of the array. Leaves the array untouched and returns [code]null[/code] if the array is empty or if it's accessed out of bounds. An error message is printed when the array is accessed out of bounds, but not when the array is empty.
|
||||
[b]Note:[/b] On large arrays, this method can be slower than [method pop_back] as it will reindex the array's elements that are located after the removed element. The larger the array and the lower the index of the removed element, the slower [method pop_at] will be.
|
||||
</description>
|
||||
</method>
|
||||
<method name="pop_back">
|
||||
<return type="Variant" />
|
||||
<description>
|
||||
|
||||
Reference in New Issue
Block a user