WIP unpacking of parameters.
This commit is contained in:
1 parent
72a3d74a97
commit
a65d16c9ba
11 files changed
+106
-30
No files matched your search
@@ -834,12 +834,13 @@ public class Auxiliary {
|
||||
throw new InternalExpressionException("'schedule' should have at least 2 arguments, delay and call name");
|
||||
long delay = NumericValue.asNumber(lv.get(0).evalValue(c)).getLong();
|
||||
|
||||
FunctionArgument<LazyValue> functionArgument = FunctionArgument.findIn(c, expression.module, lv, 1, false, true);
|
||||
FunctionArgument<LazyValue> functionArgument = FunctionArgument.findIn(c, expression.module, lv, 1, false, false);
|
||||
List<Value> args = functionArgument.unpackArgs(c);
|
||||
|
||||
CarpetServer.scriptServer.events.scheduleCall(
|
||||
(CarpetContext) c,
|
||||
functionArgument.function,
|
||||
FunctionValue.resolveArgs(functionArgument.args, c, t),
|
||||
args,
|
||||
delay
|
||||
);
|
||||
return (c_, t_) -> Value.TRUE;
|
||||
@@ -1043,7 +1044,7 @@ public class Auxiliary {
|
||||
}
|
||||
else
|
||||
{
|
||||
success = host.getScriptServer().events.handleCustomEvent(event, host, callback.function, FunctionValue.resolveArgs(callback.args, c, t) )?Value.TRUE:Value.FALSE;
|
||||
success = host.getScriptServer().events.handleCustomEvent(event, host, callback.function, callback.unpackArgs(c) )?Value.TRUE:Value.FALSE;
|
||||
}
|
||||
return (cc, tt) -> success;
|
||||
});
|
||||
|
||||
@@ -308,7 +308,7 @@ public class Entities {
|
||||
}
|
||||
else
|
||||
{
|
||||
types.forEach(et -> events.addBuiltInEvent(CarpetEventServer.Event.getEntityLoadEventName(et), c.host, funArg.function, FunctionValue.resolveArgs(funArg.args, c, t)));
|
||||
types.forEach(et -> events.addBuiltInEvent(CarpetEventServer.Event.getEntityLoadEventName(et), c.host, funArg.function, funArg.unpackArgs(c)));
|
||||
}
|
||||
Value ret = new NumericValue(types.size());
|
||||
return (cc, tt) -> ret;
|
||||
@@ -326,7 +326,7 @@ public class Entities {
|
||||
|
||||
FunctionArgument<LazyValue> funArg = FunctionArgument.findIn(c, expression.module, lv, 2, true, false);
|
||||
|
||||
((EntityValue) v).setEvent((CarpetContext)c, what, funArg.function, FunctionValue.resolveArgs(funArg.args, c, t));
|
||||
((EntityValue) v).setEvent((CarpetContext)c, what, funArg.function, funArg.unpackArgs(c));
|
||||
|
||||
return LazyValue.NULL;
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user