Fix miscellaneous oddities around the class reference (part 4)
This commit is contained in:
@ -477,7 +477,15 @@
|
||||
<method name="sort">
|
||||
<return type="void" />
|
||||
<description>
|
||||
Sorts the dictionary in-place by key. This can be used to ensure dictionaries with the same contents produce equivalent results when getting the [method keys], getting the [method values], and converting to a string. This is also useful when wanting a JSON representation consistent with what is in memory, and useful for storing on a database that requires dictionaries to be sorted.
|
||||
Sorts the dictionary in ascending order, by key. The final order is dependent on the "less than" ([code]<[/code]) comparison between keys.
|
||||
[codeblocks]
|
||||
[gdscript]
|
||||
var numbers = { "c": 2, "a": 0, "b": 1 }
|
||||
numbers.sort()
|
||||
print(numbers) # Prints { "a": 0, "b": 1, "c": 2 }
|
||||
[/gdscript]
|
||||
[/codeblocks]
|
||||
This method ensures that the dictionary's entries are ordered consistently when [method keys] or [method values] are called, or when the dictionary needs to be converted to a string through [method @GlobalScope.str] or [method JSON.stringify].
|
||||
</description>
|
||||
</method>
|
||||
<method name="values" qualifiers="const">
|
||||
|
||||
Reference in New Issue
Block a user