Encapsulate EmbeddedScript variables

This commit is contained in:
2020-12-09 13:03:50 -07:00
parent d2ad9f4a07
commit 3e86922fd2

View File

@@ -20,9 +20,13 @@ class EmbeddedScript {
var instructionPointer = 0;
var running = false;
// TODO encapsulate these?
public var breakPoints:Map<Int, () -> Bool> = [];
public var onBreak:() -> Void = null;
private var instructions:Array<Command> = null;
private var breakPoints:Map<Int, () -> Bool> = [];
private var onBreak:() -> Void = null;
public function setBreakHandler(handler:() -> Void) {
onBreak = handler;
}
public function addBreakPoint(instruction:Int, ?condition:() -> Bool) {
if (condition == null) {
@@ -31,6 +35,10 @@ class EmbeddedScript {
breakPoints[instruction] = condition;
}
public function removeBreakPoint(instruction:Int) {
breakPoints.remove(instruction);
}
public function new() {}
#if macro