Add multiple event waiting support

This commit is contained in:
Kirigaya Kazuto 2018-01-04 14:35:10 +08:00
parent 7f905760d2
commit bd44d42ab4

View File

@ -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,...)