r/lua • u/TheGameTheorys55 • Sep 26 '26
Help Can you delete output in Lua?
Just asking, cuz I wanna make a wordle game but dunno if I could delete stuff in the console. And if you can't, why not? A lot of languages like C++ have ways such as escape sequences to overwrite lines with spaces. Does Lua have a way?
10
Upvotes
View all comments
2
u/weregod Sep 27 '26 edited Sep 27 '26
You want some TUI library like readline or ncurses. Both has Lua bindings.
You can write same escape sequences as C++ but you can't detect terminal from Lua without some C library. If you want same control as from C/C++ you need something like luaposix.
If you want to learn how terminal works you can just write escape sequenses for your terminal to stdout with io.write() but it will be not portable.