Jump to content




This is how to create a new line after using term.write("")


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

#1 WattDev

  • Members
  • 22 posts

Posted 17 April 2017 - 07:40 AM

Have you guys wondering how to create a new line after using these code like term.write to tell something to user??


These are the basic function for program/api to make a new line

function newLine()
  xPos, yPos = term.getCursorPos()
  term.setCursorPos(1,(yPos + 1))
end

Easy huh?

#2 TheRockettek

  • Members
  • 547 posts
  • LocationRem is best girl

Posted 17 April 2017 - 09:15 AM

you can always use print(). It has text wrapping and makes a new line after calling.

#3 H4X0RZ

  • Members
  • 1,315 posts
  • LocationGermany

Posted 17 April 2017 - 11:25 AM

Or just use print instead of term.write?

#4 Waitdev_

  • Members
  • 432 posts
  • LocationAdelaide

Posted 17 April 2017 - 11:58 AM

Or just use \n in the string at the end?

#5 Exerro

  • Members
  • 801 posts

Posted 17 April 2017 - 12:11 PM

term.write doesn't handle newlines. It's only print/write that do because they word wrap.

Anyway, yeah, print"", and write"\n" both do the exact same thing as the whole 4 line function.

#6 Lyqyd

    Lua Liquidator

  • Moderators
  • 8,465 posts

Posted 17 April 2017 - 03:17 PM

It's not just that you can use write or print to more easily move to a new line, this also doesn't scroll the screen if you're already on the bottom row.

#7 Bomb Bloke

    Hobbyist Coder

  • Moderators
  • 7,099 posts
  • LocationTasmania (AU)

Posted 17 April 2017 - 10:32 PM

Sort of worth noting that term.redirect() can be used to get access print/write through displays other than the default. External monitors, for eg.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users