mirror of
https://github.com/Kiritow/OpenComputerScripts.git
synced 2024-03-22 13:10:46 +08:00
Add multiple event waiting support
This commit is contained in:
parent
7f905760d2
commit
bd44d42ab4
12
libevent.lua
12
libevent.lua
|
@ -166,10 +166,20 @@ function WaitEvent(...)
|
|||
elseif(type(tb[1])=="number") then -- WaitEvent(1),event.pull(1)
|
||||
return doEventTranslate(table.pack(event.pull(tb[1])))
|
||||
else
|
||||
error("syntax error. Usage: WaitEvent([EventName],[TimeOutSecond])")
|
||||
error("Syntax error. Usage: WaitEvent([EventName],[TimeOutSecond])")
|
||||
end
|
||||
end
|
||||
|
||||
function WaitMultipleEvent(...)
|
||||
local tb=table.pack(...)
|
||||
for i=1,tb.n,1 do
|
||||
if(type(tb[i])~="string") then
|
||||
error("Syntax error. Usage: WaitMultipleEvent(EventName1,[EventName2]...)")
|
||||
end
|
||||
end
|
||||
return doEventTranslate(table.pack(event.pullMultiple(...)))
|
||||
end
|
||||
|
||||
function PushEvent(EventName,...)
|
||||
checkstring(EventName)
|
||||
return event.push(EventName,...)
|
||||
|
|
Loading…
Reference in New Issue
Block a user