-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathkeyboard.lua
More file actions
57 lines (49 loc) · 1.56 KB
/
keyboard.lua
File metadata and controls
57 lines (49 loc) · 1.56 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
---@meta
--- OpenComputers Keyboard API
---
--- Provides key code lookup and keyboard state query utilities.
---@class KeyboardLib
local keyboard = {}
keyboard.keys = {
c = 0x2E,
d = 0x20,
q = 0x10,
w = 0x11,
back = 0x0E, -- backspace
delete = 0xD3,
down = 0xD0,
enter = 0x1C,
home = 0xC7,
lcontrol = 0x1D,
left = 0xCB,
lmenu = 0x38, -- left Alt
lshift = 0x2A,
pageDown = 0xD1,
rcontrol = 0x9D,
right = 0xCD,
rmenu = 0xB8, -- right Alt
rshift = 0x36,
space = 0x39,
tab = 0x0F,
up = 0xC8,
["end"] = 0xCF,
numpadenter = 0x9C,
}
--- Checks if one of the Alt keys is currently held down.
---@return boolean True if Alt is held
function keyboard.isAltDown() end
--- Checks if the specified character is a control character.
---@param char number Character code
---@return boolean True if control character
function keyboard.isControl(char) end
--- Checks if one of the Control keys is currently held down.
---@return boolean True if Control is held
function keyboard.isControlDown() end
--- Checks if a specific key is currently held down.
---@param charOrCode string|number Character or key code
---@return boolean True if key is held
function keyboard.isKeyDown(charOrCode) end
--- Checks if one of the Shift keys is currently held down.
---@return boolean True if Shift is held
function keyboard.isShiftDown() end
return keyboard