Skip to content

Input ​

Reference for the input API.

Functions ​

input.show_cursor ​

Show the mouse cursor.

lua
---@param show bool
function input.show_cursor(show): nil

input.disable_input ​

Disable input to Lexis.

lua
---@param disable bool
function input.disable_input(disable): nil

input.key ​

Get a key state.

lua
---@param vk integer
function input.key(vk): input_keyboard_state

input.mouse ​

Get a mouse key state.

lua
---@param vk integer
function input.mouse(vk): input_mouse_state

input.pad ​

Get a controller key state.

lua
---@param key integer
function input.pad(key): input_pad_state

input.mouse_position ​

Get the position of the mouse cursor.

lua
function input.mouse_position(): vec2

input.is_mouse_within ​

If the mouse cursor is within a given bounds.

lua
---@param position vec2
---@param scale vec2
function input.is_mouse_within(position, scale): bool

input.get_clipboard_text ​

Get the text in your clipboard.

lua
function input.get_clipboard_text(): string

input.set_clipboard_text ​

Set your clipboard text.

lua
---@param str string
function input.set_clipboard_text(str): nil

Types ​

input_keyboard_state ​

FieldType
pressedbool
just_pressedbool
just_releasedbool
namestring

input_mouse_state ​

FieldType
double_clickedbool
pressedbool
just_pressedbool
just_releasedbool
namestring

input_pad_state ​

FieldType
pressedbool
just_pressedbool
just_releasedbool

Examples ​

lua
INPUT_ATTACK = 0x18
VK_W = 0x57
VK_LEFT_MOUSE = 0x01

print('w just pressed: ', input.key(VK_W).just_pressed)
print('left mouse being held: ', input.mouse(VK_LEFT_MOUSE).pressed)
print('mouse position: ', input.mouse_position())
print('attacking: ', input.pad(INPUT_ATTACK).pressed)