v0.3.0 - Nothing works. I'm confused as hell. I can't figure this out.
This commit is contained in:
+23
-8
@@ -1,17 +1,32 @@
|
||||
local event = {}
|
||||
|
||||
function event.pull(timeout, type)
|
||||
local ocelot = component.proxy(component.list("ocelot")())
|
||||
|
||||
function event.pull(type, timeout)
|
||||
checkArg(1, type, "string", "nil")
|
||||
checkArg(2, timeout, "number", "nil")
|
||||
local startTime = computer.uptime()
|
||||
local args
|
||||
repeat
|
||||
for _, eventArgs in ipairs(_G.evmgr.eventQueue) do
|
||||
if eventArgs[1] >= startTime and (eventArgs[2] == type or not type) then
|
||||
args = eventArgs
|
||||
for i = 1, #evmgr.eventQueue do
|
||||
ocelot.log("Args 1 and 2:")
|
||||
ocelot.log(tostring(evmgr.eventQueue[i][1]))
|
||||
ocelot.log(tostring(evmgr.eventQueue[i][2]))
|
||||
ocelot.log(tostring(evmgr.eventQueue[i][3]))
|
||||
ocelot.log(tostring(evmgr.eventQueue[i][4]))
|
||||
if evmgr.eventQueue[i][1] >= startTime and (evmgr.eventQueue[i][2] == type or not type) then
|
||||
args = evmgr.eventQueue[i]
|
||||
break
|
||||
end
|
||||
end
|
||||
coroutine.yield()
|
||||
until args
|
||||
table.remove(args, 1)
|
||||
return args
|
||||
if not args then
|
||||
coroutine.yield()
|
||||
end
|
||||
until args and not timeout or args and timeout and (args or computer.uptime() >= startTime + timeout)
|
||||
if args then
|
||||
table.remove(args, 1)
|
||||
return table.unpack(args)
|
||||
end
|
||||
end
|
||||
|
||||
return event
|
||||
Reference in New Issue
Block a user