add some more dumping stuff to natives

This commit is contained in:
Daniella / Tove 2022-03-07 18:02:48 +01:00
parent 91b05d9f3d
commit f377560e21

View file

@ -780,6 +780,27 @@ public class ISBPL {
stack.push(new ISBPLObject(getType("int"), 0)); stack.push(new ISBPLObject(getType("int"), 0));
}; };
break; break;
case "_getvars":
func = (File file) -> {
ISBPLObject[] objects = new ISBPLObject[functionStack.size()];
int i = 0;
for (HashMap<String, ISBPLCallable> map : functionStack) {
ArrayList<ISBPLObject> strings = new ArrayList<>();
for (String key : map.keySet()) {
if(key.startsWith("=")) {
strings.add(toISBPLString(key.substring(1)));
}
}
objects[i++] = new ISBPLObject(getType("array"), strings.toArray(new ISBPLObject[0]));
}
ISBPLObject array = new ISBPLObject(getType("array"), objects);
};
break;
case "stacksize":
func = (File file) -> {
stack.push(new ISBPLObject(getType("int"), stack.size()));
};
break;
} }
functionStack.peek().put(name, func); functionStack.peek().put(name, func);
} }