wolfhacklua API 1.1 Forum

input

The state of keys and mouse buttons anywhere, while the game or the overlay menu has the focus.

since 1.0permission: input

These functions need the input permission: list it in the manifest and have the user grant it on the Scripts page. They report state only (is this key down right now); there is no history and no way to send keys. They return nothing useful while neither the game nor the menu has the focus. See input for virtual-key codes.

Reference#

input.key_down#permission: inputsince 1.0

input.key_down(vk: integer): boolean

Asks whether a key or mouse button is down.

ParameterTypeDescription
vkintegerA Windows virtual-key code, for example 0x46 for F or 0x01 for the left mouse button.
ReturnsDescription
booleanWhether the key or button is held.
lua
-- manifest: "permissions": ["input"]
local was = false
events.on("frame", function()
  local down = input.key_down(0x46)   -- F
  if down and not was then log.info("F pressed") end
  was = down
end)

input.mouse#permission: inputsince 1.0

input.mouse(): number | nil, number

The pointer position in overlay pixels.

ReturnsDescription
number | nilPointer x, or nil when it cannot be read.
numberPointer y.
API 1.1 · source docs-src/api/input.json