iskeypressed
Accepts a virtual-key code, a name ("space", "shift", "ctrl", "alt", "tab", "escape", "left", "right", "up", "down", "lmb", "rmb", "mmb", letters…), or an Enum.KeyCode item. Only reports true while the game is focused.
Syntax
iskeypressed(key: string) -> boolean
Parameters
| Parameter | Type | Description |
|---|---|---|
key | string | The key or secret used by the operation. |
Returns
| Type | Description |
|---|---|
boolean | Boolean |
Description
iskeypressed is part of the Input & clipboard library. Input helpers read or synthesize OS input and only report state while the game window is focused.
The call is a predicate: it inspects the current state and returns a boolean without modifying anything.
Example
if iskeypressed("f") then
print("F is held")
end
Notes
- Input status is focus-gated and only reports while the game is active.