Skip to content
Michael edited this page Oct 3, 2022 · 32 revisions

key

key([code]) -> pressed

Parameters

  • code : the key code to check (1..65), see the table below.

Returns

  • pressed : a Boolean value which indicates whether or not the specified key is currently pressed. If no keycode is specified, it will return a Boolean value indicating if any key is being pressed.
*** KEYCODES ***

01 = A
02 = B
03 = C
04 = D
05 = E
06 = F
07 = G
08 = H
09 = I
10 = J
11 = K
12 = L
13 = M
14 = N
15 = O
16 = P
17 = Q
18 = R
19 = S
20 = T
21 = U
22 = V
23 = W
24 = X
25 = Y
26 = Z

27 = 0
28 = 1
29 = 2
30 = 3
31 = 4
32 = 5
33 = 6
34 = 7
35 = 8
36 = 9

37 = MINUS
38 = EQUALS
39 = LEFTBRACKET
40 = RIGHTBRACKET
41 = BACKSLASH
42 = SEMICOLON
43 = APOSTROPHE
44 = GRAVE
45 = COMMA
46 = PERIOD
47 = SLASH

48 = SPACE
49 = TAB

50 = RETURN
51 = BACKSPACE
52 = DELETE
53 = INSERT

54 = PAGEUP
55 = PAGEDOWN
56 = HOME
57 = END
58 = UP
59 = DOWN
60 = LEFT
61 = RIGHT

62 = CAPSLOCK
63 = CTRL
64 = SHIFT
65 = ALT


.-----------------------------------------------------------------------------------------.        .----------------------.
|  `  |  1  |  2  |  3  |  4  |  5  |  6  |  7  |  8  |  9  |  0  |  -  |  =  |  Backsps  |        |  Ins  |  Home | PgUp |
|-----------------------------------------------------------------------------------------|        |----------------------|
|  Tab   |  Q  |  W  |  E  |  R  |  T  |  Y  |  U  |  I  |  O  |  P  |  [  |  ]  |   \    |        |  Del  |  End  | PgDn |
|-----------------------------------------------------------------------------------------|        '----------------------'
|  CapsLck  |  A  |  S  |  D  |  F  |  G  |  H  |  J  |  K  |  L  |  ;  |  '  |    Enter  |
|-----------------------------------------------------------------------------------------|                .-------.
|  Shift       |  Z  |  X  |  C  |  V  |  B  |  N  |  M  |  ,  |  .  |  /  |       Shift  |                |   Up  |
|-----------------------------------------------------------------------------------------|        .----------------------.
|  Ctrl  |  Alt  |                                                       |  Alt  |  Ctrl  |        |  Left |  Down | Rght |
'-----------------------------------------------------------------------------------------'        '----------------------'

Description

The function returns true if the key denoted by keycode is pressed otherwise it returns false.

Clone this wiki locally