Rednet messenger
phaleron 20 Jan 2013
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
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 20 Jan 2013
You mean that you want to send for an example the varible A and the varible B at once?
phaleron 20 Jan 2013
stabby 20 Jan 2013
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")
phaleron 20 Jan 2013
stabby, on 20 January 2013 - 06:39 AM, said:
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")
phaleron 20 Jan 2013
FF0084 20 Jan 2013
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.
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 20 Jan 2013
FF0084, on 20 January 2013 - 08:00 AM, said:
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.
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