Skip to content

Commit

Permalink
Fix incorrect c# in OS.get_cmdline_args
Browse files Browse the repository at this point in the history
  • Loading branch information
Fulanko authored and divshekhar committed Apr 23, 2024
1 parent c65a479 commit c9d8099
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions doc/classes/OS.xml
Original file line number Diff line number Diff line change
Expand Up @@ -189,26 +189,26 @@
for argument in OS.get_cmdline_args():
if argument.contains("="):
var key_value = argument.split("=")
arguments[key_value[0].lstrip("--")] = key_value[1]
arguments[key_value[0].trim_prefix("--")] = key_value[1]
else:
# Options without an argument will be present in the dictionary,
# with the value set to an empty string.
arguments[argument.lstrip("--")] = ""
arguments[argument.trim_prefix("--")] = ""
[/gdscript]
[csharp]
var arguments = new Godot.Collections.Dictionary();
var arguments = new Dictionary<string, string>();
foreach (var argument in OS.GetCmdlineArgs())
{
if (argument.Contains('='))
{
string[] keyValue = argument.Split("=");
arguments[keyValue[0].LStrip("--")] = keyValue[1];
arguments[keyValue[0].TrimPrefix("--")] = keyValue[1];
}
else
{
// Options without an argument will be present in the dictionary,
// with the value set to an empty string.
arguments[keyValue[0].LStrip("--")] = "";
arguments[argument.TrimPrefix("--")] = "";
}
}
[/csharp]
Expand Down

0 comments on commit c9d8099

Please sign in to comment.