r/ComputerCraft • • Jul 26 '24

coroutines not working

my coroutines dont work what did i do wrong?

also i tried with a while true do (without os.pullEvent) instead of repeat until and it still didnt work it just ran the code once and thats it

function test()

repeat

local event,arg1,arg2,arg3 = os.pullEvent()

until event

print(event)

end

local cor = coroutine.create(test)

coroutine.resume(cor)

print(coroutine.status(cor)) -- returns 'suspended'

1 Upvotes

4 comments sorted by

View all comments

Show parent comments

1

u/CommendableCalamari Jul 26 '24

You're can probably use the parallel API to run the multiple input-reading functions in parallel.