> For the complete documentation index, see [llms.txt](https://0x29a.gitbook.io/0x29a-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://0x29a.gitbook.io/0x29a-docs/runtime/input.md).

# input

**interface · global: `input`**

Raw keyboard/mouse state via `GetAsyncKeyState`, independent of whatever the overlay is currently capturing for itself — use this for gameplay logic (e.g. "hold a button to enable aim"); for input inside an ImGui window, use [ui](/0x29a-docs/interface/ui.md) instead.

### `input.down(vk) -> bool`

`true` while the `vk` key/button is physically held down.

### `input.pressed(vk) -> bool`

`true` only on the frame where `vk` transitioned from up → down (edge detection, with per-key state kept internally).

### `input.released(vk) -> bool`

The reverse of `pressed`: `true` on the frame where `vk` was released.

### `input.mouse() -> x, y`

Cursor position in screen coordinates.

### `input.mouse_down(button=0) -> bool`

`button`: `0` = left, `1` = right, `2` = middle.

### `input.move_mouse(x, y) -> bool`

Moves the system cursor to `(x, y)`. Returns `false` if `SetCursorPos` fails.

## `input.KEY.*`

A table of virtual-key constants, so you don't spread magic numbers around your script:

* Letters: `input.KEY.A` … `input.KEY.Z`
* Digits: `input.KEY["0"]` … `input.KEY["9"]`
* Function keys: `input.KEY.F1` … `input.KEY.F12`
* Navigation: `HOME END PGUP PGDN INSERT DELETE LEFT RIGHT UP DOWN`
* Modifiers: `SHIFT CTRL ALT LSHIFT RSHIFT LCTRL RCTRL`
* Special: `SPACE ENTER ESC TAB CAPS BACKSPACE`
* Mouse: `LMOUSE RMOUSE MMOUSE MOUSE4 MOUSE5`
* Numpad: `NUM0` … `NUM9`

```lua
if input.pressed(input.KEY.F6) then
    print("F6 pressed")
end
```

To bind this to a function without managing edge-state yourself, see [`bind`/`unbind`](/0x29a-docs/introduction/hotkeys.md) in the bootstrap.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://0x29a.gitbook.io/0x29a-docs/runtime/input.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
