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

While help again

Started by je06, 04 May 2012 - 09:00 PM
je06 #1
Posted 04 May 2012 - 11:00 PM
error is:
rednet:347: positive number expected

program is:
while true do
write("Port:")
port = read()
rednet.open(port)
write("Id:")
Sip = read()
while true do
write("Message:")
m = read()
rednet.send(Sip, .)
end
end

Output is:
Port: –I put top
Id: –i put 39
Message: – I put Hi
rednet:347: positive number expected

Can Some one help?
MysticT #2
Posted 04 May 2012 - 11:43 PM
the id given to rednet.send() must be a number, your variable is a string. Use tonumber to convert first:

local id = tonumber(read())
rednet.send(id, "Your message")