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

How Can I Preserve A Variable Across Rednet?

Started by JohnOptegrove, 05 November 2013 - 07:24 PM
JohnOptegrove #1
Posted 05 November 2013 - 08:24 PM
I'm trying to set up a stargate control system using Rednet and two computers. My idea is to store the address for the stargate to dial in the variable "address", then send the contents of "address" over Rednet to the other terminal which would then wrap the stargate as a peripheral and dial it.

Is this possible and if so how would I go about doing it?
Lyqyd #2
Posted 06 November 2013 - 10:51 AM
Split into new topic.

Yep, just send the variable contents and receive it on the other side.
Bomb Bloke #3
Posted 06 November 2013 - 04:22 PM
In particular, you'll be making use of either the modem or Rednet APIs.

What gets sent is the contents of your variable, which you dump into a new variable at the other end. If you wish to send a table (instead of a single value), you'll want to make use of textutils.serialize().
Lyqyd #4
Posted 06 November 2013 - 08:49 PM
Tables can be sent across without the need for serialization and deserialization in more recent versions.