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

term.clearLine() don't works

Started by Alerith, 23 April 2013 - 10:21 AM
Alerith #1
Posted 23 April 2013 - 12:21 PM
Title self explanatory. It doesn't matter from what code. Some simple like this:

term.clear()
term.setCursorPos(1,1)
print("Hi")
sleep(2)
term.clearLine()
term.setCursorPos(1,2)
print("How are you?")
sleep(2)

Neither.

Someone got a solution? I need to clear the line D:
Kingdaro #2
Posted 23 April 2013 - 12:27 PM
When you use print, the function automatically moves the cursor position down to the next line. Try using term.write instead.
Engineer #3
Posted 23 April 2013 - 12:41 PM
When you use print, the function automatically moves the cursor position down to the next line. Try using term.write instead.
I remember that you said somewhere that using write is much better then the term.write :P/>
Kingdaro #4
Posted 23 April 2013 - 12:43 PM
When you use print, the function automatically moves the cursor position down to the next line. Try using term.write instead.
I remember that you said somewhere that using write is much better then the term.write :P/>/>
The better of the two functions depends on your purpose. If you're rendering windows and GUIs and such, it's better to use term.write, and when making console applications, you should just use write.

The difference being that write word-wraps what you print, and if you use it with a GUI, some parts of it might appear on the left side of the screen if carelessly implemented. term.write does not word wrap, and is better for drawing, but text gets cut off if it's too long.
Sammich Lord #5
Posted 23 April 2013 - 12:43 PM
When you use print, the function automatically moves the cursor position down to the next line. Try using term.write instead.
I remember that you said somewhere that using write is much better then the term.write :P/>
Just using write adds word wrap. Term.wrap doesn't. So if you want speed use term.write.