summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHugo Locurcio <hugo.locurcio@hugo.pro>2020-05-16 23:52:40 +0200
committerHugo Locurcio <hugo.locurcio@hugo.pro>2020-05-16 23:52:40 +0200
commit675fea16489048919a059d10c4ae846cc7fe4ba7 (patch)
tree15168f03711cc6554a13d570ea313bc757f23553
parent163687d17a8a11da3cf1a3595c511a5f8fc94571 (diff)
Document that Dictionary is always passed as reference
See #38792.
-rw-r--r--doc/classes/Array.xml2
-rw-r--r--doc/classes/Dictionary.xml1
2 files changed, 2 insertions, 1 deletions
diff --git a/doc/classes/Array.xml b/doc/classes/Array.xml
index 20296bbf45..7593f7dff4 100644
--- a/doc/classes/Array.xml
+++ b/doc/classes/Array.xml
@@ -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>
diff --git a/doc/classes/Dictionary.xml b/doc/classes/Dictionary.xml
index e982e00d6d..385f4b7e59 100644
--- a/doc/classes/Dictionary.xml
+++ b/doc/classes/Dictionary.xml
@@ -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.