long story short, im wanting to insert some code into a table from one program and send it to another program
this is how my table is being set up
serverUsage = "Quarantine Test"
local dataDump = {}
if Modemtest == true then
term.clear()
term.setCursorPos(1,1)
print("Please Enter The Servers Information")
local w,h = term.getSize()
term.setCursorPos(math.floor(w-#"Server ID:")/2-5,3)
print("Server ID:")
term.setCursorPos(math.floor(w-#"Server Sync Code:")/2-2,5)
print("Server Sync Code:")
term.setCursorPos(math.floor(w+#"Server ID:")/2-5,3)
servID = io.read()
term.setCursorPos(math.floor(w+#"Server Sync Code:")/2-2,5)
servSyncCode = io.read()
term.setCursorPos(1,8) --testing purposes
print(servID) --testing purposes
term.setCursorPos(1,9) --testing purposes
print(servSyncCode) --testing purposes
--dataSendServerUsage = tonumber(serverUsage)
table.insert(dataDump, 1, servSyncCode)
table.insert(dataDump, 2, serverUsage)
dataSend = textutils.serialize(dataDump)
rednet.send(tonumber(servID), dataDump)
so from my understanding servSyncCode is a read variable resulting in a string and serverUsage is a string variable
so after running it should look like this if im correct
local dataDump = {"whatever the user entered", "Quarantine Test"}
Now what the user entered should be a number so if i converted it to a number instead of a string then it should look like this
local dataDump = {225554444, "Quarantine Test"}
now for the other program that recieves the table
randomCodeGen = math.random(100000000,999999999) --gen a random number
table.insert(syncCodeStorage, randomCodeGen) -- inserts the random number to a temp table
print(syncCodeStorage[1]) --prints the random number so the user knows what it is
syncLoop = true
while syncLoop == true do
local event, ID, syncData = os.pullEventRaw()
if event == "rednet_message" then -- waiting for a rednet event
local dataCache = textutils.unserialize(syncData) -- unserialize the table that was serialized from the other program and sent
if tonumber(dataCache[1]) == syncCodeStorage[1] then --compairing the first key of the sent table which should be 225554444 to the random number that was generated
rednet.send(ID, "CorrectSyncCode")
else
rednet.send(ID, "IncorrectSyncCode")
end
end
end
everytime the while loop is ran, once it gets a rednet message i get the error
"Textutils:304: attempt to concatenate string and table"
Can someone point out where im going wrong, hope there is enough detail and isnt to cinfusing for you
Thanks, MrProgrammer