added a timeout to event.pull

This commit is contained in:
Izaya 2017-08-03 12:22:51 +10:00
parent 08a94c879b
commit f736810fc3
1 changed files with 4 additions and 2 deletions

View File

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