1610 posts
Posted 18 June 2013 - 08:52 PM
I was wondering if there was anyway that, using coroutines (possibly) I could pull events without stopping the main flow of the program? Specifically, update monitors with animations while also waiting for bundled cable updates and monitor touches. Could anyone help please?
Thanks!
7083 posts
Location
Tasmania (AU)
Posted 18 June 2013 - 09:08 PM
function pullEvents()
while true do
event, etc1, etc2, etc3 = os.pullEvent()
-- Do stuff with the events that get pulled.
end
end
function updateDisplays()
while true do
-- Draw stuff on screens etc.
end
end
parallel.waitForAny(pullEvents, updateDisplays)
1610 posts
Posted 19 June 2013 - 06:16 AM
function pullEvents()
while true do
event, etc1, etc2, etc3 = os.pullEvent()
-- Do stuff with the events that get pulled.
end
end
function updateDisplays()
while true do
-- Draw stuff on screens etc.
end
end
parallel.waitForAny(pullEvents, updateDisplays)
Thanks for replying! I'll try this when I get home!