mirror of
https://github.com/IgorTimofeev/MineOS.git
synced 2025-12-20 11:09:21 +01:00
Create Event.lua
This commit is contained in:
parent
2b68b4b4f9
commit
8f5e89a645
@ -2,8 +2,9 @@
|
||||
local event, handlers, interruptingKeysDown, lastInterrupt = {
|
||||
interruptingEnabled = true,
|
||||
interruptingDelay = 1,
|
||||
interruptingFunction = error,
|
||||
defaultInterruptingFunction = error,
|
||||
defaultInterruptingFunction = function()
|
||||
error("interrupted", 0)
|
||||
end,
|
||||
interruptingKeyCodes = {
|
||||
[29] = true,
|
||||
[46] = true,
|
||||
@ -12,6 +13,8 @@ local event, handlers, interruptingKeysDown, lastInterrupt = {
|
||||
push = computer.pushSignal
|
||||
}, {}, {}, 0
|
||||
|
||||
event.interruptingFunction = event.defaultInterruptingDFunction
|
||||
|
||||
local computerPullSignal, computerUptime, mathHuge, mathMin, skipSignalType = computer.pullSignal, computer.uptime, math.huge, math.min
|
||||
|
||||
--------------------------------------------------------------------------------------------------------
|
||||
@ -106,7 +109,8 @@ function event.pull(preferredTimeout)
|
||||
|
||||
if shouldInterrupt and uptime - lastInterrupt > event.interruptingDelay then
|
||||
lastInterrupt = uptime
|
||||
event.interruptingFunction("interrupted", 0)
|
||||
|
||||
event.interruptingFunction()
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user