Appearance
sdk.keys
Win32 virtual-key names and Ctrl/Alt/Shift combos for game.input_snapshot and game.on("key_down"). Not TGameAction (that is sdk.input) and not overlay UI keys.
lua
local M = require("sdk.keys")Constants
Lua 5.4 has no enums — these are integer (or string) fields on the module.
| Name | Value | Summary |
|---|---|---|
CTRL | 1 | Ctrl bit in the modifier mask (0x1). |
ALT | 2 | Alt bit in the modifier mask (0x2). |
SHIFT | 4 | Shift bit in the modifier mask (0x4). |
codes | build_codes() | Name to Win32 virtual-key table (f1, space, numpad0, plus). |
code
function · code(name)
Resolve a key name to a Win32 virtual-key code.
Parameters
| Name | Type | Summary |
|---|---|---|
name | string | — |
Returns
| Type | Summary |
|---|---|
integer|nil | vk |
string|nil | err |
parse
function · parse(combination)
Parse a human-readable combo into a Win32 key plus Ctrl/Alt/Shift mask.
Parameters
| Name | Type | Summary |
|---|---|---|
combination | string | — |
Returns
| Type | Summary |
|---|---|
table|nil | combo |
string|nil | err |
matches
function · matches(vk, mods, combo)
True when vk equals the combo key and mods contain the combo modifiers.
Parameters
| Name | Type | Summary |
|---|---|---|
vk | integer | — |
mods | integer | — |
combo | table|string | — |
Returns
| Type | Summary |
|---|---|
boolean | — |
isPressed
function · isPressed(combo_or_key, modifiers)
Poll whether a combo or virtual key is held, with optional required modifiers.
Parameters
| Name | Type | Summary |
|---|---|---|
combo_or_key | table|string|integer | — |
modifiers? | integer | — |
Returns
| Type | Summary |
|---|---|
boolean|nil | held |
string|nil | err |