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

Rednet Help (Turtle)

Started by freiguy48, 10 March 2012 - 03:28 AM
freiguy48 #1
Posted 10 March 2012 - 04:28 AM
okay so I have some simple programs but I wan't to have it so that I can use a terminal to turn on a turtle program or to have a message to broadcast what the print("message") says back to my terminal what kind of a code could I use.
ChaosBeing #2
Posted 10 March 2012 - 06:46 AM
Try something like this:

ID, msg = rs.receive(3)

if msg then
loadstring(msg)
end


With this you just send whatever commands you want the receiver to run over rednet, and once it receives them, it will run them. For example, if you sent it print("Hello, World!") then the receiving term/turtle would run it, and print out the message Hello, World!
Sebra #3
Posted 10 March 2012 - 06:50 AM
loadstring return function, not execute it
Liraal #4
Posted 10 March 2012 - 04:39 PM
This should work:

ID, msg = rs.receive(3)

if msg then
local tmp=loadstring(msg)
tmp()
end