diff options
Diffstat (limited to 'doc/classes/Dictionary.xml')
-rw-r--r-- | doc/classes/Dictionary.xml | 26 |
1 files changed, 17 insertions, 9 deletions
diff --git a/doc/classes/Dictionary.xml b/doc/classes/Dictionary.xml index 59088f33fd..adc1eab393 100644 --- a/doc/classes/Dictionary.xml +++ b/doc/classes/Dictionary.xml @@ -40,7 +40,7 @@ }; [/csharp] [/codeblocks] - You can access a dictionary's values by referencing the appropriate key. In the above example, [code]points_dir["White"][/code] will return [code]50[/code]. You can also write [code]points_dir.White[/code], which is equivalent. However, you'll have to use the bracket syntax if the key you're accessing the dictionary with isn't a fixed string (such as a number or variable). + You can access a dictionary's values by referencing the appropriate key. In the above example, [code]points_dict["White"][/code] will return [code]50[/code]. You can also write [code]points_dict.White[/code], which is equivalent. However, you'll have to use the bracket syntax if the key you're accessing the dictionary with isn't a fixed string (such as a number or variable). [codeblocks] [gdscript] export(string, "White", "Yellow", "Orange") var my_color @@ -72,7 +72,7 @@ my_dict = {"First Array": [1, 2, 3, 4]} # Assigns an Array to a String key. [/gdscript] [csharp] - var myDir = new Godot.Collections.Dictionary + var myDict = new Godot.Collections.Dictionary { {"First Array", new Godot.Collections.Array{1, 2, 3, 4}} }; @@ -85,7 +85,7 @@ points_dict["Blue"] = 150 # Add "Blue" as a key and assign 150 as its value. [/gdscript] [csharp] - var pointsDir = new Godot.Collections.Dictionary + var pointsDict = new Godot.Collections.Dictionary { {"White", 50}, {"Yellow", 75}, @@ -98,7 +98,7 @@ [codeblocks] [gdscript] # This is a valid dictionary. - # To access the string "Nested value" below, use `my_dir.sub_dir.sub_key` or `my_dir["sub_dir"]["sub_key"]`. + # To access the string "Nested value" below, use `my_dict.sub_dict.sub_key` or `my_dict["sub_dict"]["sub_key"]`. # Indexing styles can be mixed and matched depending on your needs. var my_dict = { "String Key": 5, @@ -109,8 +109,7 @@ [/gdscript] [csharp] // This is a valid dictionary. - // To access the string "Nested value" below, use `my_dir.sub_dir.sub_key` or `my_dir["sub_dir"]["sub_key"]`. - // Indexing styles can be mixed and matched depending on your needs. + // To access the string "Nested value" below, use `((Godot.Collections.Dictionary)myDict["sub_dict"])["sub_key"]`. var myDict = new Godot.Collections.Dictionary { {"String Key", 5}, {4, new Godot.Collections.Array{1,2,3}}, @@ -213,7 +212,8 @@ <return type="bool" /> <argument index="0" name="key" type="Variant" /> <description> - Erase a dictionary key/value pair by key. Returns [code]true[/code] if the given key was present in the dictionary, [code]false[/code] otherwise. Does not erase elements while iterating over the dictionary. + Erase a dictionary key/value pair by key. Returns [code]true[/code] if the given key was present in the dictionary, [code]false[/code] otherwise. + [b]Note:[/b] Don't erase elements while iterating over the dictionary. You can iterate over the [method keys] array instead. </description> </method> <method name="get" qualifiers="const"> @@ -290,12 +290,22 @@ </method> <method name="operator !=" qualifiers="operator"> <return type="bool" /> + <description> + </description> + </method> + <method name="operator !=" qualifiers="operator"> + <return type="bool" /> <argument index="0" name="right" type="Dictionary" /> <description> </description> </method> <method name="operator ==" qualifiers="operator"> <return type="bool" /> + <description> + </description> + </method> + <method name="operator ==" qualifiers="operator"> + <return type="bool" /> <argument index="0" name="right" type="Dictionary" /> <description> </description> @@ -319,6 +329,4 @@ </description> </method> </methods> - <constants> - </constants> </class> |