This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
jebus's profile picture

cannot resume dead coroutine

Started by jebus, 28 January 2013 - 11:09 AM
jebus #1
Posted 28 January 2013 - 12:09 PM
I get this error from parallel:22 rednet:287
with this code:


print("start")
rednet.open("right")
if rednet.broadcast("ping") then
print("broadcast")
end
rednet.receive(1)

rednet.close() does not help

I think (not sure) this code worked when I was alone on the server and started failing when someone joined.

How can I resolve this or what is wrong?
NeverCast #2
Posted 28 January 2013 - 12:17 PM
Seems like it's having a heart attack while trying to read from a redstone port.
Are you using bundled cable or a modem?

If modem, do you have any bundled cable connected?

Edit: Could also be a timer triggering this.
jebus #3
Posted 28 January 2013 - 12:42 PM
Just a computer, diskdrive, a floppy and a wireless mining turtle…
ChunLing #4
Posted 28 January 2013 - 05:19 PM
Does the device you're running this code on have a modem on it's right side? Which is to say, are you running this on a computer that doesn't have a modem attached on the right side?
jebus #5
Posted 29 January 2013 - 12:47 AM
It does I'm running it on a turtle
It doesn't crash when I say rednet.receive() instead of rednet.receive(2)
jebus #6
Posted 29 January 2013 - 12:55 AM

rednet.open("right")
while true do
print("receive")
a,b,c = rednet.receive(2)
print(a,b,c)
end

now works


rednet.open("right")
while true do
if rednet.broadcast("ping") then
print("braodcasting")
end
sleep(2)
end

doesn't

111
Press any key to continue

or

bios -1 bios -1 (or bios -1 rednet 287) cannot resume dead coroutine
Press any key to continue

or

shell:166 Expected number
111

or
rednet 277 bios -1 rednet 369 vm error: java.lang.arrayIndexOutOfBoundsException (152) 10

are the errors I get

And I do not get why the errors don't remain the same, since the code remains the same…
Edited on 29 January 2013 - 12:14 AM
jebus #7
Posted 29 January 2013 - 02:44 AM
Other turtles (even non wireless) seem to be affected too…
soccer16x #8
Posted 29 January 2013 - 12:53 PM
im having the same trouble with this code, but running from a computer not a turtle, and the problem is that whenever i press one of the corresponding keys to wirelessly move my turtle I get that error you got on the computer that was running this code.
while true do
   event, key = os.pullEvent("key")
   if key == keys.up then
	rednet.send(turtle,"up")
   elseif key == keys.down then
	rednet.send(turtle,"down")
   elseif key == keys.d then
	rednet.send(turtle,"right")
   elseif key == keys.a then
	rednet.send(turtle,"left")
   elseif key == keys.w then
	rednet.send(turtle,"forward")
   elseif key == keys.s then
	rednet.send(turtle,"back")
   elseif key == keys.q then
	break
   elseif key == keys.left then
	rednet.send(turtle,"break")
   elseif key == keys.right then
	rednet.send(turtle,"place")
   elseif key == 2 then
	rednet.send(turtle,"1")
   elseif key == 3 then
	rednet.send(turtle,"2")
   elseif key == 4 then
	rednet.send(turtle,"3")
   elseif key == 5 then
	rednet.send(turtle,"4")
   elseif key == 6 then
	rednet.send(turtle,"5")
   elseif key == 7 then
	rednet.send(turtle,"6")
   elseif key == 8 then
	rednet.send(turtle,"7")
   elseif key == 9 then
	rednet.send(turtle,"8")
   end

EDIT: The problem is fixed, all i did though was close the world then go back in.