26 posts
Posted 29 July 2014 - 01:31 PM
So I made a program to communicate with other computers using rednet. I am trying to add protocols but when I add them, just gives me an error: "parallel:22: rednet:68: Expected Number". Focus on the receive() and send() functions where the rednet.send() and rednet.receive() are. Though it works when the protocol strings in rednet.receive() and rednet.send() are not there… I have no idea…
PastebinyBxeiDnc
46 posts
Posted 29 July 2014 - 02:13 PM
you get that error because on line 9 you are using the rednet.receive function which takes 1 argument which is timeout and which is a integer however you are providing a string which will not work i believe you should look at rednet.host which may help you or maybe use the events returned by rednet.receive to filter the requests to only acknowledge those utilizing a certain protocol
Edited on 29 July 2014 - 12:16 PM
26 posts
Posted 29 July 2014 - 04:11 PM
Yeah, I am sure there is an easier way, but I got it to work without protocols. Instead I used tables.
pastebin
Edited on 29 July 2014 - 02:27 PM
8543 posts
Posted 29 July 2014 - 04:18 PM
you get that error because on line 9 you are using the rednet.receive function which takes 1 argument which is timeout and which is a integer however you are providing a string which will not work i believe you should look at rednet.host which may help you or maybe use the events returned by rednet.receive to filter the requests to only acknowledge those utilizing a certain protocol
That's not even close to correct. The 1.6+ version of the rednet API has a receive function that takes up to two arguments. You can give it a timeout, or a protocol, or a protocol and a timeout.
Of course, if you're not using a 1.6+ version of ComputerCraft (1.58 or earlier), you would get the number expected error, since rednet did not support protocols then.
26 posts
Posted 29 July 2014 - 04:36 PM
you get that error because on line 9 you are using the rednet.receive function which takes 1 argument which is timeout and which is a integer however you are providing a string which will not work i believe you should look at rednet.host which may help you or maybe use the events returned by rednet.receive to filter the requests to only acknowledge those utilizing a certain protocol
That's not even close to correct. The 1.6+ version of the rednet API has a receive function that takes up to two arguments. You can give it a timeout, or a protocol, or a protocol and a timeout.
Of course, if you're not using a 1.6+ version of ComputerCraft (1.58 or earlier), you would get the number expected error, since rednet did not support protocols then.
Yeah, seems I am in 1.5.2.
46 posts
Posted 29 July 2014 - 04:45 PM
you get that error because on line 9 you are using the rednet.receive function which takes 1 argument which is timeout and which is a integer however you are providing a string which will not work i believe you should look at rednet.host which may help you or maybe use the events returned by rednet.receive to filter the requests to only acknowledge those utilizing a certain protocol
That's not even close to correct. The 1.6+ version of the rednet API has a receive function that takes up to two arguments. You can give it a timeout, or a protocol, or a protocol and a timeout.
Of course, if you're not using a 1.6+ version of ComputerCraft (1.58 or earlier), you would get the number expected error, since rednet did not support protocols then.
ah that's new information for me i thought protocols were only available through the modem api shows that i haven't been following api updates