Skip to content

Commit 90b5c77

Browse files
committed
Wrong git state, argument count oversight fix
1 parent 8158701 commit 90b5c77

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/main/java/carpet/script/api/Auxiliary.java

+5-2
Original file line numberDiff line numberDiff line change
@@ -706,9 +706,12 @@ else if (!interactable && targetBlock == null)
706706
}
707707
});
708708

709-
expression.addContextFunction("run_async", 1, (c, t, lv) ->
709+
expression.addContextFunction("run_async", 2, (c, t, lv) ->
710710
{
711711
CommandSourceStack source = ((CarpetContext) c).source();
712+
if(lv.size() < 2) {
713+
throw new InternalExpressionException("run_async(expr, callback) requires two arguments!");
714+
}
712715
FunctionArgument callback = FunctionArgument.findIn(c, expression.module, lv, 1, true, false);
713716
String command = lv.get(0).getString();
714717
if(callback.function == null)
@@ -730,7 +733,7 @@ else if (!interactable && targetBlock == null)
730733
}
731734
else if (callback.function.getArguments().size() < 1)
732735
{
733-
throw new InternalExpressionException("callback requires 1 argument for command output");
736+
throw new InternalExpressionException("callback requires 1 argument for command output!");
734737
}
735738
boolean[] isCallbackConsumed = {false};
736739
try

0 commit comments

Comments
 (0)