This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
Sepatar's profile picture

Clearing only selected lines?

Started by Sepatar, 30 November 2012 - 10:49 AM
Sepatar #1
Posted 30 November 2012 - 11:49 AM
I want to make a program that will only clear the 4th and 5th lines.
term.clear() clears everything, so I'm guessing that there's something that you put in the "()"s?
Kingdaro #2
Posted 30 November 2012 - 12:10 PM
You can just go to the line with term.setCursorPos(), then use term.clearLine().

term.setCursorPos(1,4)
term.clearLine()
term.setCursorPos(1,5)
term.clearLine()
remiX #3
Posted 30 November 2012 - 01:25 PM
Or make a function to clear a specific line which I use in my programs.


function clrLine(y)
    cX, cY = term.getCursorPos()
    term.setCursorPos(1,y)
    term.clearLine()
    term.setCursorPos(cX, cY)
end

The getting cursor position and setting it back to it is only if you need that, I just added it now but I don't use it.