Fix typo with example variable name in Dictionary docs, and fix error in C# example
This commit is contained in:
parent
c7f67daccd
commit
9359bee75c
@ -40,7 +40,7 @@
|
|||||||
};
|
};
|
||||||
[/csharp]
|
[/csharp]
|
||||||
[/codeblocks]
|
[/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]
|
[codeblocks]
|
||||||
[gdscript]
|
[gdscript]
|
||||||
export(string, "White", "Yellow", "Orange") var my_color
|
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.
|
my_dict = {"First Array": [1, 2, 3, 4]} # Assigns an Array to a String key.
|
||||||
[/gdscript]
|
[/gdscript]
|
||||||
[csharp]
|
[csharp]
|
||||||
var myDir = new Godot.Collections.Dictionary
|
var myDict = new Godot.Collections.Dictionary
|
||||||
{
|
{
|
||||||
{"First Array", new Godot.Collections.Array{1, 2, 3, 4}}
|
{"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.
|
points_dict["Blue"] = 150 # Add "Blue" as a key and assign 150 as its value.
|
||||||
[/gdscript]
|
[/gdscript]
|
||||||
[csharp]
|
[csharp]
|
||||||
var pointsDir = new Godot.Collections.Dictionary
|
var pointsDict = new Godot.Collections.Dictionary
|
||||||
{
|
{
|
||||||
{"White", 50},
|
{"White", 50},
|
||||||
{"Yellow", 75},
|
{"Yellow", 75},
|
||||||
@ -98,7 +98,7 @@
|
|||||||
[codeblocks]
|
[codeblocks]
|
||||||
[gdscript]
|
[gdscript]
|
||||||
# This is a valid dictionary.
|
# 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.
|
# Indexing styles can be mixed and matched depending on your needs.
|
||||||
var my_dict = {
|
var my_dict = {
|
||||||
"String Key": 5,
|
"String Key": 5,
|
||||||
@ -109,8 +109,7 @@
|
|||||||
[/gdscript]
|
[/gdscript]
|
||||||
[csharp]
|
[csharp]
|
||||||
// This is a valid dictionary.
|
// 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 `((Godot.Collections.Dictionary)myDict["sub_dict"])["sub_key"]`.
|
||||||
// Indexing styles can be mixed and matched depending on your needs.
|
|
||||||
var myDict = new Godot.Collections.Dictionary {
|
var myDict = new Godot.Collections.Dictionary {
|
||||||
{"String Key", 5},
|
{"String Key", 5},
|
||||||
{4, new Godot.Collections.Array{1,2,3}},
|
{4, new Godot.Collections.Array{1,2,3}},
|
||||||
|
Loading…
Reference in New Issue
Block a user