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
e94259e98b
commit
639b35e7ef
19
libevent.lua
19
libevent.lua
|
@ -1,9 +1,24 @@
|
|||
require("checkarg")
|
||||
local event=require("event")
|
||||
|
||||
function AddEventListener(EventString,CallbackFunction)
|
||||
return event.listen(EventString,CallbackFunction)
|
||||
function AddEventListener(EventName,CallbackFunction)
|
||||
checkstring(EventName)
|
||||
checkfunction(CallbackFunction)
|
||||
return event.listen(EventName,CallbackFunction)
|
||||
end
|
||||
|
||||
function RemoveEventListener(ListenerID)
|
||||
checknumber(ListenerID)
|
||||
return event.ignore(event.handlers[ListenerID].key,event.handlers[ListenerID].callback)
|
||||
end
|
||||
|
||||
function WaitEvent(EventName)
|
||||
checkstring(EventName)
|
||||
return event.pull(EventName)
|
||||
end
|
||||
|
||||
function WaitEventFor(EventName,TimeOut)
|
||||
checkstring(EventName)
|
||||
checknumber(TimeOut)
|
||||
return event.pull(TimeOut,EventName)
|
||||
end
|
Loading…
Reference in New Issue
Block a user