Skip to content

Commit

Permalink
Document that Dictionary is always passed as reference
Browse files Browse the repository at this point in the history
See godotengine#38792.

(cherry picked from commit 675fea1)
  • Loading branch information
Calinou authored and akien-mga committed May 18, 2020
1 parent 4779d28 commit 8ebcdeb
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion doc/classes/Array.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
var array2 = [3, "Four"]
print(array1 + array2) # ["One", 2, 3, "Four"]
[/codeblock]
Arrays are always passed by reference.
[b]Note:[/b] Arrays are always passed by reference. To get a copy of an array which can be modified independently of the original array, use [method duplicate].
</description>
<tutorials>
</tutorials>
Expand Down
1 change: 1 addition & 0 deletions doc/classes/Dictionary.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
Dictionary type. Associative container which contains values referenced by unique keys. Dictionaries are composed of pairs of keys (which must be unique) and values. Dictionaries will preserve the insertion order when adding elements, even though this may not be reflected when printing the dictionary. In other programming languages, this data structure is sometimes referred to as an hash map or associative array.
You can define a dictionary by placing a comma-separated list of [code]key: value[/code] pairs in curly braces [code]{}[/code].
Erasing elements while iterating over them [b]is not supported[/b] and will result in undefined behavior.
[b]Note:[/b] Dictionaries are always passed by reference. To get a copy of a dictionary which can be modified independently of the original dictionary, use [method duplicate].
Creating a dictionary:
[codeblock]
var my_dir = {} # Creates an empty dictionary.
Expand Down

0 comments on commit 8ebcdeb

Please sign in to comment.