mirror of
https://github.com/Kiritow/OpenComputerScripts.git
synced 2024-03-22 13:10:46 +08:00
Update Event Library
This commit is contained in:
parent
639b35e7ef
commit
b21b52cc57
16
libevent.lua
16
libevent.lua
|
@ -22,3 +22,19 @@ function WaitEventFor(EventName,TimeOut)
|
|||
checknumber(TimeOut)
|
||||
return event.pull(TimeOut,EventName)
|
||||
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
|
||||
|
|
Loading…
Reference in New Issue
Block a user