private static ExecutionState Task_Get(RuntimeVM vm) { vm.ExpectStackSize(1); var taskID = vm.PopNumber("task"); var task = (ChainTask)vm.GetTask(taskID); var result = new VMObject(); result.SetValue(task); vm.Stack.Push(result); return(ExecutionState.Running); }
private static ExecutionState Task_Stop(RuntimeVM vm) { vm.ExpectStackSize(1); vm.Expect(vm.CurrentTask == null, "cannot stop task from within a task"); var taskID = vm.PopNumber("task"); var task = vm.GetTask(taskID); vm.Expect(task != null, "task not found"); vm.StopTask(task); return(ExecutionState.Running); }