[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Non blocking user input
- From: Steve Litt <slitt@...>
- Date: Thu, 20 Mar 2014 10:08:33 -0400
On Thu, 20 Mar 2014 07:00:12 -0700
Milind Gupta <milind.gupta@gmail.com> wrote:
> Hi,
> Is it possible to have a non blocking keyboard poll in Lua? If
> there is a keypress I get a key code otherwise I get no key pressed.
>
> Thanks,
> Milind
=======================================
function getch_unix()
os.execute("stty cbreak </dev/tty >/dev/tty 2>&1")
local key = io.read(1)
os.execute("stty -cbreak </dev/tty >/dev/tty 2>&1");
return(key);
end
=======================================
SteveT
Steve Litt * http://www.troubleshooters.com/
Troubleshooting Training * Human Performance