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

Rednet messenger

Started by phaleron, 20 January 2013 - 05:24 AM
phaleron #1
Posted 20 January 2013 - 06:24 AM
Hey guys,

im searching a long time for "how do i get mutyple strings in one rednet.send()".
i found something by myselfs. turn 2 a variables into one string and then convert it back again with textutils.unserialize(), textutils.serialize() and tables.
but in dont have any clue how to do that!

please help me :)/>
stabby #2
Posted 20 January 2013 - 06:29 AM
You mean that you want to send for an example the varible A and the varible B at once?
phaleron #3
Posted 20 January 2013 - 06:33 AM
You mean that you want to send for an example the varible A and the varible B at once?
yes indeed!
stabby #4
Posted 20 January 2013 - 06:39 AM

rednet.open("back") -- or whatever side your modem is on
local a = "Hey "
local b = "man"
rednet.send(id, a.. B)/>

Just use ".." after the varible to add another one (or string) For an example: (Id, "string".. "Hey".. varible.. "\n")
crazyguymgd #5
Posted 20 January 2013 - 06:44 AM
Then you have to parse the resulting string at the sender.
phaleron #6
Posted 20 January 2013 - 06:55 AM

rednet.open("back") -- or whatever side your modem is on
local a = "Hey "
local b = "man"
rednet.send(id, a.. B)/>/>

Just use ".." after the varible to add another one (or string) For an example: (Id, "string".. "Hey".. varible.. "\n")
Thats perfect! thx!
phaleron #7
Posted 20 January 2013 - 06:56 AM
Then you have to parse the resulting string at the sender.
is parse like converting?
and how do i do it?
FF0084 #8
Posted 20 January 2013 - 08:00 AM
textutils.serialize

You can easily create a table, serialize it and send it as a single string. Then call textutils.unserialize function to get the table back.
W00dyR #9
Posted 20 January 2013 - 08:09 AM
textutils.serialize

You can easily create a table, serialize it and send it as a single string. Then call textutils.unserialize function to get the table back.


Another function that is usefull for this kind of stuff, is


table.concat(<table name>, " ")

Adds up all the things in the table into a single line string
FF0084 #10
Posted 20 January 2013 - 08:16 AM
Another function that is usefull for this kind of stuff, is


table.concat(<table name>, " ")

Adds up all the things in the table into a single line string

I wish you good luck with separating the concatenated strings like this. It's pointless.
W00dyR #11
Posted 20 January 2013 - 08:18 AM
I wish you good luck with separating the concatenated strings like this. It's pointless.

Im only talking about adding up all the things into a single string, not all the other stuff, couldve read what I said at least
FF0084 #12
Posted 20 January 2013 - 08:19 AM
I wish you good luck with separating the concatenated strings like this. It's pointless.

Im only talking about adding up all the things into a single string, not all the other stuff, couldve read what I said at least

But this was not a problem sir. "couldve" read the original post mate.
W00dyR #13
Posted 20 January 2013 - 08:23 AM
I wish you good luck with separating the concatenated strings like this. It's pointless.

Im only talking about adding up all the things into a single string, not all the other stuff, couldve read what I said at least

But this was not a problem sir. "couldve" read the original post mate.

Couldve read the other posts and actually see what people are talking about.. Not here to argue so I'm not replying anymore.