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

How do I leave a blank line?

Started by DeadlyLazy, 16 December 2013 - 12:17 PM
DeadlyLazy #1
Posted 16 December 2013 - 01:17 PM
I'm new to Lua and I don't know how to leave a blank line with nothing on when printing words onto a computer screen (for example in a list, leaving a line)…

Help would be appreciated!
Lyqyd #2
Posted 16 December 2013 - 01:53 PM
Change the cursor position.


--# get current cursor position.
local x, y = term.getCursorPos()
--# set cursor position to the beginning of the line two down.
term.setCursorPos(1, y + 2)

If you need the screen to scroll, you'll have to add that in yourself. That code will move the cursor as long as it's at least two lines above the bottom of the screen.
Kingdaro #3
Posted 16 December 2013 - 09:18 PM
If you're making a simple console application, doing
print("")
works as well.
Symmetryc #4
Posted 16 December 2013 - 09:21 PM
If you're making a simple console application, doing
print("")
works as well.
I believe this even works:

print()
Alice #5
Posted 16 December 2013 - 10:46 PM
Yes it does Symmetryc, or at least in the base Lua it did.

I used it a lot in some basic scripts.