summaryrefslogtreecommitdiff
path: root/doc/classes/Dictionary.xml
diff options
context:
space:
mode:
Diffstat (limited to 'doc/classes/Dictionary.xml')
-rw-r--r--doc/classes/Dictionary.xml29
1 files changed, 19 insertions, 10 deletions
diff --git a/doc/classes/Dictionary.xml b/doc/classes/Dictionary.xml
index a9e2a38dcf..f47649363e 100644
--- a/doc/classes/Dictionary.xml
+++ b/doc/classes/Dictionary.xml
@@ -1,15 +1,24 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="Dictionary" category="Built-In Types" version="3.1">
+<class name="Dictionary" category="Built-In Types" version="3.2">
<brief_description>
Dictionary type.
</brief_description>
<description>
Dictionary type. Associative container which contains values referenced by unique keys. Dictionaries are always passed by reference.
+ Erasing elements while iterating over them [b]is not supported[/b].
+ Creating a dictionary:
+ [codeblock]
+ var d = {4: 5, "A key": "A value", 28: [1, 2, 3]}
+ [/codeblock]
+ To add a key to an existing dictionary, access it like an existing key and assign to it:
+ [codeblock]
+ d[4] = "hello" # Add integer 4 as a key and assign the String "hello" as its value.
+ d["Godot"] = 3.01 # Add String "Godot" as a key and assign the value 3.01 to it.
+ [/codeblock]
</description>
<tutorials>
+ <link>https://docs.godotengine.org/en/latest/getting_started/scripting/gdscript/gdscript_basics.html#dictionary</link>
</tutorials>
- <demos>
- </demos>
<methods>
<method name="clear">
<description>
@@ -29,7 +38,7 @@
<return type="bool">
</return>
<description>
- Return true if the dictionary is empty.
+ Return [code]true[/code] if the dictionary is empty.
</description>
</method>
<method name="erase">
@@ -38,7 +47,7 @@
<argument index="0" name="key" type="Variant">
</argument>
<description>
- Erase a dictionary key/value pair by key.
+ Erase a dictionary key/value pair by key. Do not erase elements while iterating over the dictionary.
</description>
</method>
<method name="get">
@@ -49,7 +58,7 @@
<argument index="1" name="default" type="Variant" default="Null">
</argument>
<description>
- Returns the current value for the specified key in the [code]Dictionary[/code]. If the key does not exist, the method returns the value of the optional default argument, or Null if it is omitted.
+ Returns the current value for the specified key in the [Dictionary]. If the key does not exist, the method returns the value of the optional default argument, or Null if it is omitted.
</description>
</method>
<method name="has">
@@ -58,7 +67,7 @@
<argument index="0" name="key" type="Variant">
</argument>
<description>
- Return true if the dictionary has a given key.
+ Return [code]true[/code] if the dictionary has a given key.
</description>
</method>
<method name="has_all">
@@ -67,7 +76,7 @@
<argument index="0" name="keys" type="Array">
</argument>
<description>
- Return true if the dictionary has all of the keys in the given array.
+ Return [code]true[/code] if the dictionary has all of the keys in the given array.
</description>
</method>
<method name="hash">
@@ -81,7 +90,7 @@
<return type="Array">
</return>
<description>
- Return the list of keys in the [code]Dictionary[/code].
+ Return the list of keys in the [Dictionary].
</description>
</method>
<method name="size">
@@ -95,7 +104,7 @@
<return type="Array">
</return>
<description>
- Return the list of values in the [code]Dictionary[/code].
+ Return the list of values in the [Dictionary].
</description>
</method>
</methods>