Posted 18 September 2014 - 06:13 AM
So, im making a website thing that sends and receives data, and I have the server setup, but the client isn't working, so its receiving a text and background packet, i said print the table part, and it printed what I wanted to see but whenever I use it in term.setBackgroundColor(serverData[1]) its not working :(/>. heres the code for both the server and client, pls focus on the client mainly:
Client:
Server:
Client:
rednet.open("top")
rednet.broadcast("")
id, message = rednet.receive()
websiteData = textutils.serialize(message)
website = textutils.serialize(message)
local serverData = {
[1] = (message[1])
}
term.setBackgroundColor(serverData[1])
term.clear()
Server:
os.unloadAPI("api")
rednet.open("top")
id, message = rednet.receive()
local websiteTitle = {
[1] = ("website.com"),
[2] = ("Welcome to the test website!")
}
local websiteData = {
[1] = ("colors.gray"), --background color
[2] = ("colors.blue") --text main color
}
local errorPackets = {
[1] = ("Unknown data request, disconnecting"),
[2] = ("Error proccessing data."),
[3] = ("There was 1 or 2 errors proccessing data,"),
[4] = ("so we could not send anymore data to you.")
}
function transmitPacket(data)
rednet.send(id,data)
end
function unknownDataRequest()
rednet.send(id,errorPackets)
end
transmitPacket(websiteData)
Edited on 18 September 2014 - 04:14 AM