Update Event Library

This commit is contained in:
Kirigaya Kazuto 2017-10-23 19:09:15 +08:00
parent 639b35e7ef
commit b21b52cc57

View File

@ -21,4 +21,20 @@ function WaitEventFor(EventName,TimeOut)
checkstring(EventName)
checknumber(TimeOut)
return event.pull(TimeOut,EventName)
end
end
function AddTimer(Interval,CallbackFunction,Times)
checknumber(Interval)
checkfunction(CallbackFunction)
if(type(Times)~=nil) then -- Timer will run [Times] times.
checknumber(Times)
return event.timer(Interval,CallbackFunction,Times)
else -- Timer will run once.
return event.timer(Interval,CallbackFunction)
end
end
function RemoveTimer(TimerID)
checknumber(TimerID)
return event.cancel(TimerID)
end