Jump to content




How do I leave a blank line?


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

#1 DeadlyLazy

  • New Members
  • 1 posts

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!

#2 Lyqyd

    Lua Liquidator

  • Moderators
  • 8,465 posts

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.

#3 Kingdaro

    The Doctor

  • Members
  • 1,636 posts
  • Location'MURICA

Posted 16 December 2013 - 09:18 PM

If you're making a simple console application, doing
print("")
works as well.

#4 Symmetryc

  • Members
  • 434 posts

Posted 16 December 2013 - 09:21 PM

View PostKingdaro, on 16 December 2013 - 09:18 PM, said:

If you're making a simple console application, doing
print("")
works as well.
I believe this even works:
print()


#5 Alice

  • Members
  • 429 posts
  • LocationBehind you.

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.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users