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

Does rednet.receive() Have A Large Delay?

Started by jjjhfam, 04 July 2015 - 04:16 AM
jjjhfam #1
Posted 04 July 2015 - 06:16 AM
I need to use rednet.receive() often with a "while true do" loop and then do things with the data I receive. The receiving data may come in very often, would I need to worry about a delay while I use the received data and missing a transmission?
HPWebcamAble #2
Posted 04 July 2015 - 07:20 AM
No, when a computer starts executing code, other computers can't run code until it yields, that is, calls 'os.pullEvent()'

Usually this isn't noticeable, since most programs don't run for more than a half a second, and those that run for too long are stopped automatically (Too long without yielding error)
Edited on 04 July 2015 - 05:47 AM
MKlegoman357 #3
Posted 04 July 2015 - 08:04 AM
What you should avoid is yielding inside the script. This includes any function which waits, like sleep and read.
HPWebcamAble #4
Posted 04 July 2015 - 08:08 AM
What you should avoid is yielding inside the script. This includes any function which waits, like sleep and read.

So in other words, don't yield unless its waiting for a message