summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rw-r--r--scripts/toy.groovy18
1 files changed, 7 insertions, 11 deletions
diff --git a/scripts/toy.groovy b/scripts/toy.groovy
index 3d8b064..f5182aa 100644
--- a/scripts/toy.groovy
+++ b/scripts/toy.groovy
@@ -207,17 +207,13 @@ def removeEvent = { name ->
saveEvents(events);
};
def execEvents = { rt ->
- def events = loadEvents();
- events
- .findAll({ e -> e.value.time <= getTime() })
- .each({ e ->
- def f = namedEvents[e.value.func];
- events.remove(e.key);
- saveEvents(events);
- if (f) {
- f(e.key, e.value.arg, e.value.time, rt);
- }
- })
+ for (def e = nextEvent(loadEvents()); e && e.event.time <= getTime(); e = nextEvent(loadEvents())) {
+ def f = namedEvents[e.event.func];
+ removeEvent(e.name);
+ if (f) {
+ f(e.name, e.event.arg, e.event.time, rt);
+ }
+ }
};
def sessionAborted = null;
def gagText = { t, p ->