added a timeout to event.pull

This commit is contained in:
Izaya 2017-08-03 12:22:51 +10:00
parent 08a94c879b
commit f736810fc3

View File

@ -61,8 +61,10 @@ do -- so local works
return eq[tT[cT].ep - 1] return eq[tT[cT].ep - 1]
end end
end end
function event.pull(t) -- return or wait for the next event, optionally with the first param matching t function event.pull(t,time) -- return or wait for the next event, optionally with the first param matching t
while true do time = time or math.huge
time = time + computer.uptime()
while computer.uptime() < time do
local e = event.get() local e = event.get()
if e then if e then
if t then if t then