mirror of
https://github.com/godotengine/godot-docs.git
synced 2026-01-05 22:09:56 +03:00
classref: Sync with current 4.3 branch (6699ae7)
This commit is contained in:
@@ -2,8 +2,8 @@
|
||||
|
||||
.. DO NOT EDIT THIS FILE!!!
|
||||
.. Generated automatically from Godot engine sources.
|
||||
.. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
|
||||
.. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/Array.xml.
|
||||
.. Generator: https://github.com/godotengine/godot/tree/4.3/doc/tools/make_rst.py.
|
||||
.. XML source: https://github.com/godotengine/godot/tree/4.3/doc/classes/Array.xml.
|
||||
|
||||
.. _class_Array:
|
||||
|
||||
@@ -522,7 +522,7 @@ Appends another ``array`` at the end of this array.
|
||||
var numbers = [1, 2, 3]
|
||||
var extra = [4, 5, 6]
|
||||
numbers.append_array(extra)
|
||||
print(nums) # Prints [1, 2, 3, 4, 5, 6]
|
||||
print(numbers) # Prints [1, 2, 3, 4, 5, 6]
|
||||
|
||||
.. rst-class:: classref-item-separator
|
||||
|
||||
@@ -1289,7 +1289,7 @@ Sorts the array in ascending order. The final order is dependent on the "less th
|
||||
|
||||
Sorts the array using a custom :ref:`Callable<class_Callable>`.
|
||||
|
||||
\ ``func`` is called as many times as necessary, receiving two array elements as arguments. The function should return ``true`` if the first element should be moved *behind* the second one, otherwise it should return ``false``.
|
||||
\ ``func`` is called as many times as necessary, receiving two array elements as arguments. The function should return ``true`` if the first element should be moved *before* the second one, otherwise it should return ``false``.
|
||||
|
||||
::
|
||||
|
||||
@@ -1304,7 +1304,7 @@ Sorts the array using a custom :ref:`Callable<class_Callable>`.
|
||||
print(my_items) # Prints [["Rice", 4], ["Tomato", 5], ["Apple", 9]]
|
||||
|
||||
# Sort descending, using a lambda function.
|
||||
my_items.sort_custom(func(a, b): return a[0] > b[0])
|
||||
my_items.sort_custom(func(a, b): return a[1] > b[1])
|
||||
print(my_items) # Prints [["Apple", 9], ["Tomato", 5], ["Rice", 4]]
|
||||
|
||||
It may also be necessary to use this method to sort strings by natural order, with :ref:`String.naturalnocasecmp_to<class_String_method_naturalnocasecmp_to>`, as in the following example:
|
||||
|
||||
Reference in New Issue
Block a user