Posted 30 May 2014 - 09:38 PM
I have been having a problem with a simple piece of code(or so i thought) to display a table which can be remotely edited.
What actually happens is as expected, until I send the message containing "departed", at which point the screen clears, but the table doesn't redraw, it just stays blank. Why is this?
Before "departed":
After "departed":
term.clear()
local tFlights = {}
rednet.open("left")
while true do
term.setCursorPos(1,1)
id,message = rednet.receive()
if message == "departed" then
tFlights[1] = nil
term.clear()
for i, o in ipairs(tFlights) do
print(i, " ", o)
end
else
table.insert(tFlights, message)
term.clear()
for i, o in ipairs(tFlights) do
print(i, " ", o)
end
end
end
In theory, this code should display an empty screen, until a rednet message arrives, and then the contents of the message should be appended to the table, the terminal cleared and the contents of the table, with key numbers, redrawn. If the message contains just "departed" then the first item in the table should be removed and the table redrawn.What actually happens is as expected, until I send the message containing "departed", at which point the screen clears, but the table doesn't redraw, it just stays blank. Why is this?
Before "departed":
After "departed":