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

Print text to monitor on the next line

Started by larperdoodle, 29 August 2012 - 07:30 PM
larperdoodle #1
Posted 29 August 2012 - 09:30 PM
I have been using:
lua
mon = peripheral.wrap("right")
mon.write("My text here")
But I want to have text on multiple lines. So what code do I put in to have to go to the next line?
OmegaVest #2
Posted 29 August 2012 - 10:23 PM
mon.write("n")

That should be a new line escape character. That, or you can use this fairly convoluted method.


x, y = mon.getCursorPos()
y = y +1
mon.setCursorPos(0, y)
Andybish #3
Posted 30 August 2012 - 12:21 AM
I'd have to agree, \n creates a new line character, so
mon.write("Hello\nworld")
Returns:
Hello
world
Luanub #4
Posted 30 August 2012 - 01:30 AM
You may have problems getting n to work with mon.write(). See this thread for some possible solutions. http://www.computercraft.info/forums2/index.php?/topic/3655-monitor-problem/
larperdoodle #5
Posted 30 August 2012 - 03:42 AM
Wow, that was fast. Thanks everyone!