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

Auto new line, while printing very long strings

Started by DannySMc, 20 October 2014 - 08:14 AM
DannySMc #1
Posted 20 October 2014 - 10:14 AM
How would I go about say printing lots of information on a screen without having to manually add in a new line? so use a function that will print 51 characters then next line and print the rest?
Bomb Bloke #2
Posted 20 October 2014 - 10:44 AM
write() and print() will automatically apply word-wrap in this manner, whereas term.write() will not.

Edit:

Though I suppose it's worth noting that write()/print() will only work for the purposes of outputting to whatever your active terminal is.

If you don't want to term.redirect() to a display on which you wish to use word-wrap, then make your own function. You'll want to get the screen size then use that information to craft a loop incorporating string.sub() and term.setCursorPos().
Edited on 20 October 2014 - 08:50 AM