lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

Klaus Ripke wrote:

> however, if you are targeting xterms and modern consoles,
> you can easily do it yourself in lua without too much
> special casing (all but the ioctl for stty -raw).
> see
> for a very small example of a card game in a unicode xterm
> including mouse wheel control in pure lua with an exec of
> stty.

I haven't run it yet, but I just looked at the source code,
and this is pretty cool.  The magic thing that steps outside
of the land of pure Lua or ANSI C is:

  os.execute("stty raw -echo")

which lets Lua read input a character at a time (instead of
a line at a time), and disables automatic echoing of
characters so that the application can handle it.  This plus
knowledge of the terminal's escape sequences for cursor
positioning etc. (which I believe are fairly standardized on
modern terminals) is all that's needed to write a
Curses-style program.  This should be fun to play with.