Console clear screen

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
philfaint
Prole
Posts: 8
Joined: Wed Jul 01, 2020 6:35 pm

Console clear screen

Post by philfaint »

Hello,

i've been printing some values to console, like fps for instance, but it writes it in a new line every second (used print()). Is there any way to clear the console to make it print value on the same position in console, clearing the screen in between? I tried to use os.execute('cls'), but it gives me weird results (attached).
Thanks!
Attachments
os_execute_cls.jpg
os_execute_cls.jpg (28.54 KiB) Viewed 4092 times
User avatar
pgimeno
Party member
Posts: 3550
Joined: Sun Oct 18, 2015 2:58 pm

Re: Console clear screen

Post by pgimeno »

Maybe with the classic ESC [ H ESC [ 2 J? Not sure if that works in a Windows terminal.

Code: Select all

for i = 1, 50 do
  print("\027[H\027[2JThis tests printing a control sequence that clears the screen")
end
Post Reply

Who is online

Users browsing this forum: Google [Bot] and 231 guests