[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: [newbie] terminal handling facilities
- From: "Aaron Brown" <aaron-lua@...>
- Date: Wed, 28 Sep 2005 18:05:06 -0400
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 http://luaforge.net/frs/download.php/471/slnspider-0.9.gz
> 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.
--
Aaron