Jump to content




term.clearLine() don't works


  • You cannot reply to this topic
4 replies to this topic

#1 Alerith

  • Members
  • 36 posts

Posted 23 April 2013 - 11:21 AM

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:

#2 Kingdaro

    The Doctor

  • Members
  • 1,636 posts
  • Location'MURICA

Posted 23 April 2013 - 11:27 AM

When you use print, the function automatically moves the cursor position down to the next line. Try using term.write instead.

#3 Engineer

  • Members
  • 1,378 posts
  • LocationThe Netherlands

Posted 23 April 2013 - 11:41 AM

View PostKingdaro, on 23 April 2013 - 11:27 AM, said:

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

#4 Kingdaro

    The Doctor

  • Members
  • 1,636 posts
  • Location'MURICA

Posted 23 April 2013 - 11:43 AM

View PostEngineer, on 23 April 2013 - 11:41 AM, said:

View PostKingdaro, on 23 April 2013 - 11:27 AM, said:

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.

#5 Sammich Lord

    IRC Addict

  • Members
  • 1,212 posts
  • LocationThe Sammich Kingdom

Posted 23 April 2013 - 11:43 AM

View PostEngineer, on 23 April 2013 - 11:41 AM, said:

View PostKingdaro, on 23 April 2013 - 11:27 AM, said:

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.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users