My question is this. I need that when launching the program on lua, the user entered tex (for example, digit 1) everything was superfluous and some text was displayed, after that the user could enter more text (digit 2) Again, the superfluous was erased, but the text that was displayed with digit 1 remained another line was displayed on this line (after the introduction of the number 2). And so on. Tell me how to write it down.

  • Windows or Linux? - Egor Skriptunoff

1 answer 1

It depends on the type of terminal, but there are special Control sequences for cleaning the screen and moving the cursor.

Everything is beautifully painted on https://ru.wikipedia.org/wiki/SUN__GM_GM .

For Windows terminals, everything is a bit more complicated, but you can look at the Python-Colorama library and try to implement this on lua.

Terminals built into some programs may not support management at all.

  • In the terminal in Windows, you can control the cursor only through the WinAPI functions. But Lua does not have access to them, because supports a very limited set of Sishny libraries, conio.h is not included there (the authors of Lua worship the god of portability, and this does not lead to good) - Egor Skriptunoff
  • You can always wrap in sishny module. I looked there just like everything is written - eri
  • And what's the point in such a module? It will not be portable. In this case, it is more convenient to simply lay these functions in the host program. - Egor Skriptunoff
  • Portability is needed by Lua developers, and developers of the final software are very often not needed. Here, for example, a winbox from a mikrotik - it seems to be written on a ported GTK, but there is a version only for Windows, because the Windows driver in which the capabilities of the router are written is downloaded from the router. examples of the sea - eri