How to control screen coordinates?

Asked

Viewed 170 times

1

i need to develop a program in Lua (desktop application) that manipulates screen coordinates, does not need to be a graphical environment (GUI), but need to be able to, for example, position in the coordinate (10, 10) - row 10, column 10, and then display a text, and then re-position at these coordinates to display other text. The only way is to use a graphic Toolkit? Thank you.

1 answer

3


If you want to move the cursor on a terminal screen, you can use escape sequences for terminals, as in moon-term.

Your example would be:

term.cursor.goto(10, 10)
io.write("um texto")
...
term.cursor.goto(10, 10)
io.write("outro texto")

You don’t even need to use a library: term.cursor.goto(10, 10) is equivalent to io.write("\027[10;10H"). See also this message.

For a list of the most common escape sequences, see for example http://ascii-table.com/ansi-escape-sequences.php.

  • 1

    Great, solved my problem. Thank you so much for your help! :)

Browser other questions tagged

You are not signed in. Login or sign up in order to post.