Skip to content

Commit 3b7895d

Browse files
Update GlobalVariableMethod.cs
1 parent 2f80215 commit 3b7895d

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

Code/MethodSystem/Methods/GeneralVariableMethods/GlobalVariableMethod.cs

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,17 +21,12 @@ public class GlobalVariableMethod : SynchronousMethod, ICanError
2121

2222
public override Argument[] ExpectedArguments { get; } =
2323
[
24-
new TokenArgument<VariableToken>("variable to make global")
24+
new VariableArgument("variable to make global")
2525
];
2626

2727
public override void Execute()
2828
{
29-
var variableToken = Args.GetToken<VariableToken>("variable to make global");
30-
if (variableToken.TryGetVariable().HasErrored(out var error, out var variable))
31-
{
32-
throw new ScriptRuntimeError(this, error);
33-
}
34-
29+
var variable = Args.GetVariable("variable to make global");
3530
VariableIndex.GlobalVariables.RemoveAll(existingVar => existingVar.Name == variable.Name);
3631
VariableIndex.GlobalVariables.Add(variable);
3732
}

0 commit comments

Comments
 (0)