diff options
author | zacryol <5291432-zacryol@users.noreply.gitlab.com> | 2021-09-25 19:57:29 -0600 |
---|---|---|
committer | zacryol <5291432-zacryol@users.noreply.gitlab.com> | 2021-09-26 11:16:55 -0600 |
commit | 9359bee75c865a156d71bea6f0db9de33b640641 (patch) | |
tree | b4611fa47a3439a7166df6a3157250a23aad88c5 /doc/classes/Dictionary.xml | |
parent | c7f67daccdc389d5feb89775297cd521fb9af882 (diff) |
Fix typo with example variable name in Dictionary docs, and fix error in C# example
Diffstat (limited to 'doc/classes/Dictionary.xml')
-rw-r--r-- | doc/classes/Dictionary.xml | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/doc/classes/Dictionary.xml b/doc/classes/Dictionary.xml index 0575ea3eef..bd314c5a52 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}}, |