Fix js builder

This commit is contained in:
Victor Shcherb 2019-07-09 17:20:07 +02:00
parent c2f8e12576
commit 177f2e6625

View file

@ -56,8 +56,14 @@ public class JSCommandBuilder extends CommandBuilder {
private JSCommandBuilder addCommand(String name, Object... args){
listCommands.add(name);
listCommands.add(Arrays.toString(args));
Object obj = jsScope.get(name);
for(Object o : args) {
if(o != null) {
listCommands.add(o.toString());
} else {
listCommands.add("");
}
}
Object obj = jsScope.get(name);
if (obj instanceof Function) {
Function jsFunction = (Function) obj;
Object jsResult = jsFunction.call(jsContext, jsScope, jsScope, args);