Posted 07 October 2012 - 07:15 PM
Throwing up this weird error.
Error:
Code:
w,h = term.getSize()
lineno = 1
rednet.open("back")
function listenForMessages()
while true do
local id, msg = rednet.receive()
if lineno == 16 then lineno = 1 end
local oldx,oldy = term.getCursorPos()
term.setCursorPos(1, lineno)
term.clearLine()
if string.find(msg, "::") then
term.write(string.gsub(msg, "::", ":"))
else
term.write(id..":"..msg)
end
term.setCursorPos(oldx, oldy)
end
lineno = lineno + 1
end
function sendMessages()
term.setCursorPos(1, h-1)
while true do
message = io.read()
if message == "quit" then break end
rednet.broadcast(os.getComputerLabel().."::"..message) <–I believe it is this that is causing the error.
term.setCursorPos(1, lineno)
term.write(os.getComputerID()..":"..message)
lineno = lineno + 1
term.setCursorPos(1, h-1)
term.clearLine()
end
end
term.clear()
term.setCursorPos(1, h-2)
term.write(string.rep("*", w))
parallel.waitForAny(sendMessages,
listenForMessages)
Error:
Spoiler
Code:
w,h = term.getSize()
lineno = 1
rednet.open("back")
function listenForMessages()
while true do
local id, msg = rednet.receive()
if lineno == 16 then lineno = 1 end
local oldx,oldy = term.getCursorPos()
term.setCursorPos(1, lineno)
term.clearLine()
if string.find(msg, "::") then
term.write(string.gsub(msg, "::", ":"))
else
term.write(id..":"..msg)
end
term.setCursorPos(oldx, oldy)
end
lineno = lineno + 1
end
function sendMessages()
term.setCursorPos(1, h-1)
while true do
message = io.read()
if message == "quit" then break end
rednet.broadcast(os.getComputerLabel().."::"..message) <–I believe it is this that is causing the error.
term.setCursorPos(1, lineno)
term.write(os.getComputerID()..":"..message)
lineno = lineno + 1
term.setCursorPos(1, h-1)
term.clearLine()
end
end
term.clear()
term.setCursorPos(1, h-2)
term.write(string.rep("*", w))
parallel.waitForAny(sendMessages,
listenForMessages)