three things:

- logger is carpet, fixes #522
 - fixed fancy commands to functions - so could be used later with lambdas and functions that use different argument names
 - moved a few builtin apps to commands via /carpet
This commit is contained in:
gnembon committed 2020-11-03 04:45:08 -04:00
1 parent 68cd896376
commit 741edf1465
7 files changed
+67 -30

No files matched your search

@@ -210,11 +210,11 @@ public class CarpetScriptHost extends ScriptHost
}
}
public Value handleCommand(ServerCommandSource source, String call, List<Value> args)
public Value handleCommand(ServerCommandSource source, FunctionValue function, List<Value> args)
{
try
{
return call(source, call, args);
return call(source, function, args);
}
catch (CarpetExpressionException exc)
{
@@ -330,20 +330,17 @@ public class CarpetScriptHost extends ScriptHost
}
}
public Value call(ServerCommandSource source, String call, List<Value> suppliedArgs)
public Value call(ServerCommandSource source, FunctionValue function, List<Value> suppliedArgs)
{
if (CarpetServer.scriptServer.stopAll)
throw new CarpetExpressionException("SCARPET PAUSED", null);
FunctionValue function = getFunction(call);
if (function == null)
throw new CarpetExpressionException("UNDEFINED", null);
List<LazyValue> argv = FunctionValue.lazify(suppliedArgs);
List<String> args = function.getArguments();
if (argv.size() != args.size())
{
String error = "Fail: stored function "+call+" takes "+args.size()+" arguments, not "+argv.size()+ ":\n";
String error = "Fail: stored function "+function.getPrettyString()+" takes "+args.size()+" arguments, not "+argv.size()+ ":\n";
for (int i = 0; i < max(argv.size(), args.size()); i++)
{
error += (i<args.size()?args.get(i):"??")+" => "+(i<argv.size()?argv.get(i).evalValue(null).getString():"??")+"\n";