How do you check if the rednet receive timed out. I have it set up properly to get messages but I can't find how to find out when it times out so I can do something.
Checking if rednet receive has timed out?
Started by Jasonfran, Dec 05 2012 08:37 AM
3 replies to this topic
#1
Posted 05 December 2012 - 08:37 AM
#2
Posted 05 December 2012 - 08:41 AM
If you use rednet.receive() with no arguments, it will continue forever until it receives a rednet message of any kind. Using rednet.receive(timeout) will allow you to use a specific timeout period. Say... (5) seconds.
#3
Posted 05 December 2012 - 08:49 AM
Cranium, on 05 December 2012 - 08:41 AM, said:
If you use rednet.receive() with no arguments, it will continue forever until it receives a rednet message of any kind. Using rednet.receive(timeout) will allow you to use a specific timeout period. Say... (5) seconds.
#4
Posted 05 December 2012 - 09:13 AM
The only thing you can do is check like this:
local id, msg, dist = rednet.receive(5)
if not msg then
print("message not received")
else
--do other stuff
end
2 user(s) are reading this topic
0 members, 2 guests, 0 anonymous users











