some controlflow utils

This commit is contained in:
Manuel Simon Hirsig
2015-10-02 08:50:23 +02:00
parent c7ca49b812
commit dea974ac39
4 changed files with 179 additions and 39 deletions
+61
View File
@@ -0,0 +1,61 @@
Aux.control = {}
local events = {}
local event_listeners = {}
local update_listeners = {}
function Aux.util.controller()
local ready, continuation
return {
}
end
function Aux.util.event_listener(event, action)
return {
start = function()
tinsert(events, f)
end,
stop = function()
Aux.util.remove(events, f)
end
}
end
function Aux.control.onevent()
end
function Aux.control.onupdate()
local listen_for_event(listener)
tinsert(event_listeners, listener)
return function()
Aux.util.remove(event_listeners, listener)
end
end
function wait_for_event(event)
return function
end