-
Okay, this is a little complex but I'm working on a project that has been on my mind for a long time now and I think is going to interest a few people. I don't want to let the cat out of the bag yet but it requires me to fiddle around with built-in globals. Essentially I found out that something is calling local pullEventRaw = os.pullEventRaw
os.pullEventRaw = function(sFilter)
if sFilter == "turtle_inventory" then
local result = pullEventRaw(sFilter)
print("Expected")
return result
else
local result = pullEventRaw(sFilter)
print("Unexpected")
return result
end
end
os.pullEvent("turtle_inventory")
os.pullEventRaw = pullEventRaw Any click or keypress prints |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
The easiest thing here may be to add a CraftOS doesn't run your program directly, but goes through several layers of coroutines, in order for things to run in parallel. Off the top of my head, you'll have:
|
Beta Was this translation helpful? Give feedback.
The easiest thing here may be to add a
print(debug.traceback())
call to your function, and see where these are coming from.CraftOS doesn't run your program directly, but goes through several layers of coroutines, in order for things to run in parallel. Off the top of my head, you'll have:
parallel.waitForAny
, whose loop will pull events.rednet.run
in parallel, which also pulls events.multishell
adds another layer of coroutines, and so another pullEventRaw.shell
runs each program in its own coroutine, so that's one more event pull.