Replace XML codeblock spaces with tabs

This commit is contained in:
kobewi 2025-05-17 20:00:17 +02:00 committed by Rémi Verschelde
parent 5dd76968d8
commit 13f642d959
No known key found for this signature in database
GPG key ID: C3336907360768E1
122 changed files with 2407 additions and 2432 deletions

View file

@ -14,8 +14,8 @@
var dict_variable_key = "Another key name"
var dict_variable_value = "value2"
var another_dict = {
"Some key name": "value1",
dict_variable_key: dict_variable_value,
"Some key name": "value1",
dict_variable_key: dict_variable_value,
}
var points_dict = {"White": 50, "Yellow": 75, "Orange": 100}
@ -25,16 +25,16 @@
# Additionally, key names must start with a letter or an underscore.
# Here, `some_key` is a string literal, not a variable!
another_dict = {
some_key = 42,
some_key = 42,
}
[/gdscript]
[csharp]
var myDict = new Godot.Collections.Dictionary(); // Creates an empty dictionary.
var pointsDict = new Godot.Collections.Dictionary
{
{"White", 50},
{"Yellow", 75},
{"Orange", 100}
{"White", 50},
{"Yellow", 75},
{"Orange", 100}
};
[/csharp]
[/codeblocks]
@ -44,22 +44,22 @@
@export_enum("White", "Yellow", "Orange") var my_color: String
var points_dict = {"White": 50, "Yellow": 75, "Orange": 100}
func _ready():
# We can't use dot syntax here as `my_color` is a variable.
var points = points_dict[my_color]
# We can't use dot syntax here as `my_color` is a variable.
var points = points_dict[my_color]
[/gdscript]
[csharp]
[Export(PropertyHint.Enum, "White,Yellow,Orange")]
public string MyColor { get; set; }
private Godot.Collections.Dictionary _pointsDict = new Godot.Collections.Dictionary
{
{"White", 50},
{"Yellow", 75},
{"Orange", 100}
{"White", 50},
{"Yellow", 75},
{"Orange", 100}
};
public override void _Ready()
{
int points = (int)_pointsDict[MyColor];
int points = (int)_pointsDict[MyColor];
}
[/csharp]
[/codeblocks]
@ -68,13 +68,13 @@
[codeblocks]
[gdscript]
var my_dict = {
"First Array": [1, 2, 3, 4] # Assigns an Array to a String key.
"First Array": [1, 2, 3, 4] # Assigns an Array to a String key.
}
[/gdscript]
[csharp]
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}}
};
[/csharp]
[/codeblocks]
@ -87,9 +87,9 @@
[csharp]
var pointsDict = new Godot.Collections.Dictionary
{
{"White", 50},
{"Yellow", 75},
{"Orange", 100}
{"White", 50},
{"Yellow", 75},
{"Orange", 100}
};
pointsDict["Blue"] = 150; // Add "Blue" as a key and assign 150 as its value.
[/csharp]
@ -101,20 +101,20 @@
# 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,
4: [1, 2, 3],
7: "Hello",
"sub_dict": {"sub_key": "Nested value"},
"String Key": 5,
4: [1, 2, 3],
7: "Hello",
"sub_dict": {"sub_key": "Nested value"},
}
[/gdscript]
[csharp]
// This is a valid dictionary.
// 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}},
{7, "Hello"},
{"sub_dict", new Godot.Collections.Dictionary{{"sub_key", "Nested value"}}}
{"String Key", 5},
{4, new Godot.Collections.Array{1,2,3}},
{7, "Hello"},
{"sub_dict", new Godot.Collections.Dictionary{{"sub_key", "Nested value"}}}
};
[/csharp]
[/codeblocks]
@ -123,13 +123,13 @@
[gdscript]
var groceries = {"Orange": 20, "Apple": 2, "Banana": 4}
for fruit in groceries:
var amount = groceries[fruit]
var amount = groceries[fruit]
[/gdscript]
[csharp]
var groceries = new Godot.Collections.Dictionary{{"Orange", 20}, {"Apple", 2}, {"Banana", 4}};
foreach (var (fruit, amount) in groceries)
{
// `fruit` is the key, `amount` is the value.
// `fruit` is the key, `amount` is the value.
}
[/csharp]
[/codeblocks]
@ -276,8 +276,8 @@
[codeblocks]
[gdscript]
var my_dict = {
"Godot" : 4,
210 : null,
"Godot" : 4,
210 : null,
}
print(my_dict.has("Godot")) # Prints true
@ -287,8 +287,8 @@
[csharp]
var myDict = new Godot.Collections.Dictionary
{
{ "Godot", 4 },
{ 210, default },
{ "Godot", 4 },
{ 210, default },
};
GD.Print(myDict.ContainsKey("Godot")); // Prints True
@ -299,7 +299,7 @@
In GDScript, this is equivalent to the [code]in[/code] operator:
[codeblock]
if "Godot" in {"Godot": 4}:
print("The key is here!") # Will be printed.
print("The key is here!") # Will be printed.
[/codeblock]
[b]Note:[/b] This method returns [code]true[/code] as long as the [param key] exists, even if its corresponding value is [code]null[/code].
</description>
@ -423,14 +423,14 @@
[csharp]
var dict = new Godot.Collections.Dictionary
{
["item"] = "sword",
["quantity"] = 2,
["item"] = "sword",
["quantity"] = 2,
};
var otherDict = new Godot.Collections.Dictionary
{
["quantity"] = 15,
["color"] = "silver",
["quantity"] = 15,
["color"] = "silver",
};
// Overwriting of existing keys is disabled by default.