[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Check for a keypress
- From: Justin Cormack <justin@...>
- Date: Sat, 30 Nov 2013 11:11:34 +0000
On Sat, Nov 30, 2013 at 7:10 AM, Steve Litt <slitt@troubleshooters.com> wrote:
> On Fri, 29 Nov 2013 17:58:28 -0800
> Paul Merrell <marbux@gmail.com> wrote:
>
>> On Fri, Nov 29, 2013 at 4:41 PM, Jose Torre-Bueno
>> <jtorrebueno@cox.net> wrote:
>> > Is there a way from inside Lua to check whether any key has been
>> > pressed? io.read() will get a line from the console but if there is
>> > no input it pends waiting for input. I would like to be able to
>> > write a test that gets input if any is ready but would continue if
>> > there is none. It is not obvious to me if this can be done at all.
>>
>> I don't think so. We had to implement in C the capability to read
>> input from the system's keyboard buffer when we added AutoReplace and
>> AutoCompletion features to NoteCase Pro.
>>
>> Paul
>
> Hi Paul,
>
> I've implemented Eric Raymond's way of reading keys raw, but a problem
> I ran into was that it failed on a lot of Alt key combos and other key
> combos and keystrokes. Can yours, for instance, discern between
> Alt+Shift+Ctrl F10 and Alt+Shift+F10? If so, I'd like to see it.
On Linux you are probably best off using the /dev/input devices if you
want this level of detail, you get raw keypress data (including left
vs right shift). But I don't know what the best solution is on other
platforms.
Justin