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

[solved] Rednet Send Problem

Started by android4682, 24 November 2013 - 09:05 AM
android4682 #1
Posted 24 November 2013 - 10:05 AM
I got a little problem with my script I made to call a turtle via wireless network.
http://pastebin.com/qKS5CFu4

Script gives an error on line 39 that is:

rednet.send(ID, PIN, true)
Error:

rednet:39: Expect number

But the ID is a number that is entered before the rednet command runs.
So how can I fix this?

Thanks,
Android
Edited on 25 November 2013 - 01:45 AM
MKlegoman357 #2
Posted 24 November 2013 - 01:21 PM

"2"

is not a number in Lua. It's a string - text.


2 --// is a number

So, your code should be:


ID = 2
Edited on 24 November 2013 - 12:22 PM
android4682 #3
Posted 24 November 2013 - 02:01 PM

"2"

is not a number in Lua. It's a string - text.


2 --// is a number

So, your code should be:


ID = 2

I will try that. Thanks already :)/>
android4682 #4
Posted 24 November 2013 - 03:27 PM

"2"

is not a number in Lua. It's a string - text.


2 --// is a number

So, your code should be:


ID = 2

I will try that. Thanks already :)/>

Didn't work. Still the same error. By the way could you check out line 30 I think there is the problem but I don't know how to fix it.
jay5476 #5
Posted 24 November 2013 - 03:43 PM

ID=read()
This returns a string which is why it wouldn't work to convert this to a number do

ID = tonumber(ID)
--# or do this 
ID = tonumber(read())
android4682 #6
Posted 25 November 2013 - 02:42 AM

ID=read()
This returns a string which is why it wouldn't work to convert this to a number do

ID = tonumber(ID)
--# or do this
ID = tonumber(read())

Ok I will try that. Gimme a sec.
android4682 #7
Posted 25 November 2013 - 02:44 AM

ID=read()
This returns a string which is why it wouldn't work to convert this to a number do

ID = tonumber(ID)
--# or do this
ID = tonumber(read())

Ok I will try that. Gimme a sec.

Thanks that worked :)/>