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

rednet recieve not working

Started by rellsw02, 02 October 2012 - 05:24 PM
rellsw02 #1
Posted 02 October 2012 - 07:24 PM
The problem I am having is that I got a rednet program from someone else, so it has been tested and I have seen it work for them. When I try to use it, it gives me (redTest:4: attempt to index ? (nil value))

  rednet.open("back")

  while true do
	 senderId.message.distance=rednet.recieve()
	 print(senderId..":(/>/>"..distance..":"..message)
  end
(There is a blank line between rednet and while, so the error has to do with rednet.recieve() statement)
please help
Cranium #2
Posted 02 October 2012 - 07:27 PM
You want the receive line to be this instead:

senderId, message, distance=rednet.receive() --separated by commas, not periods.
--Also, spell receive right :(/>/>
rellsw02 #3
Posted 02 October 2012 - 07:41 PM
Thank you Cranium, I did not realize that I was spelling receive wrong. I had also went on IRC and <FaintSpeaker> noticed the periods. I respelled the rednet.receive() and it worked
Cranium #4
Posted 02 October 2012 - 07:43 PM
It's actually a common mistake. I catch myself on it sometimes too. :(/>/>
BrolofTheViking #5
Posted 02 October 2012 - 08:30 PM
Oh man I spell receive wrong all the time. One of my two most frequent errors :(/>/>
PixelToast #6
Posted 02 October 2012 - 08:38 PM
same thing with coroutine.yield, so confusing some times
Fatal_Exception #7
Posted 03 October 2012 - 01:10 PM
While it's generally a stupid rule in my opinion, with far too many exceptions, the "I before E, except after C" rule actually applies in these cases.
KaoS #8
Posted 03 October 2012 - 01:47 PM
I hardly write code for myself anymore just because I'm tired of silly mistakes, I have written functions for everything, if I need to do something then that is how I do it