# get_key

Definition: | integer i = get_key()
Description: | Return the key that was pressed by the user, without waiting. Return -1 if no key was pressed. Special codes are returned for the function keys, arrow keys etc.
pwa/p2js: | Not supported.
Comments: | The operating system can hold a small number of key-hits in its keyboard buffer. get_key() will return the next one from the buffer, or -1 if the buffer is empty. Run demo\key.exw to see what key code is generated for each key on your keyboard. Note that get_key() is for console applications only and usually has no place whatsoever in a gui application. It can only catch keystrokes when the console (assuming you have one) has focus; when the gui has focus then the gui absorbs any keystrokes, as you should expect - for example see KEY.
Implementation: | via :%opGetKey in builtins\VM\pfileioN.e (an autoinclude) - be warned however it is low-level complicated stuff that you do not need to know.
See Also: | wait_key, getc