Merge pull request #90985 from Fulanko/fix-class-docs-os_get_cmdline_args
Fix incorrect C# in `OS.get_cmdline_args` docs
This commit is contained in:
commit
b7bc667fe1
|
@ -189,26 +189,26 @@
|
||||||
for argument in OS.get_cmdline_args():
|
for argument in OS.get_cmdline_args():
|
||||||
if argument.contains("="):
|
if argument.contains("="):
|
||||||
var key_value = argument.split("=")
|
var key_value = argument.split("=")
|
||||||
arguments[key_value[0].lstrip("--")] = key_value[1]
|
arguments[key_value[0].trim_prefix("--")] = key_value[1]
|
||||||
else:
|
else:
|
||||||
# Options without an argument will be present in the dictionary,
|
# Options without an argument will be present in the dictionary,
|
||||||
# with the value set to an empty string.
|
# with the value set to an empty string.
|
||||||
arguments[argument.lstrip("--")] = ""
|
arguments[argument.trim_prefix("--")] = ""
|
||||||
[/gdscript]
|
[/gdscript]
|
||||||
[csharp]
|
[csharp]
|
||||||
var arguments = new Godot.Collections.Dictionary();
|
var arguments = new Dictionary<string, string>();
|
||||||
foreach (var argument in OS.GetCmdlineArgs())
|
foreach (var argument in OS.GetCmdlineArgs())
|
||||||
{
|
{
|
||||||
if (argument.Contains('='))
|
if (argument.Contains('='))
|
||||||
{
|
{
|
||||||
string[] keyValue = argument.Split("=");
|
string[] keyValue = argument.Split("=");
|
||||||
arguments[keyValue[0].LStrip("--")] = keyValue[1];
|
arguments[keyValue[0].TrimPrefix("--")] = keyValue[1];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Options without an argument will be present in the dictionary,
|
// Options without an argument will be present in the dictionary,
|
||||||
// with the value set to an empty string.
|
// with the value set to an empty string.
|
||||||
arguments[keyValue[0].LStrip("--")] = "";
|
arguments[argument.TrimPrefix("--")] = "";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
[/csharp]
|
[/csharp]
|
||||||
|
|
Loading…
Reference in New Issue