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

rednet:350: string expected!

Started by kingkingkingkg, 20 July 2012 - 10:34 PM
kingkingkingkg #1
Posted 21 July 2012 - 12:34 AM
wheni run my "rednet repeater" for boosting rang i ge the error in the title
the code is

while true do
rednet.open("top")
M = rednet.receive()
rednet.close("top")
sleep(2)
rednet.open("Right")
rednet.broadcast(M)
end
Anyone know why its not working ive tried putting the rednet.receive IN rednet.broadcast but nothing has worked!
MysticT #2
Posted 21 July 2012 - 12:42 AM
rednet.receive returns three values: the id of the sender, the message and the distance from the sender. You want to use the message, so you have to store it:

local id, msg = rednet.receive()
And then you can use the second variable, wich contains the received message.

Also, the second rednet.open is not needed, and the side is wrong, it should be "right".
kingkingkingkg #3
Posted 21 July 2012 - 12:49 AM
still got error same one too
new code:

rednet.open("top")
local id,msg=rednet.receive()
rednet.broadcast(local)
MysticT #4
Posted 21 July 2012 - 01:58 AM
The variable that has the message is the second one (local doesn't count, it's not a variable). So it should be:

rednet.open("top")
local id, msg = rendet.receive()
rednet.broadcast(msg)
kingkingkingkg #5
Posted 27 July 2012 - 04:28 PM
Works thanks!!!