Posted 30 September 2012 - 04:10 PM
can you send an array over rednet? if not can i some how send one as a string.
local array = {}
local id, message = rednet.receive()
for word in string.gmatch(message, "%a+") do
table.insert(array, word)
end
And like inventor2514 mean, you can split the array/table when you send itYou can convert a table to a string using textutils.serialize( table )
local array = {
"chicken",
"car",
"craftComputer"
}
local sendString = ""
for _, value in pairs(array) do
sendString = sendString + " " + value
end
string.sub(sendString, 2) -- This just removes the first 'space'
rednet.send(compId, sendString)
-- This will send:
-- chicken car craftComputer