Appearance
Input
Reference for the input API.
Functions
input.show_cursor
Show the mouse cursor.
lua
---@param show bool
function input.show_cursor(show): nilinput.disable_input
Disable input to Lexis.
lua
---@param disable bool
function input.disable_input(disable): nilinput.key
Get a key state.
lua
---@param vk integer
function input.key(vk): input_keyboard_stateinput.mouse
Get a mouse key state.
lua
---@param vk integer
function input.mouse(vk): input_mouse_stateinput.pad
Get a controller key state.
lua
---@param key integer
function input.pad(key): input_pad_stateinput.mouse_position
Get the position of the mouse cursor.
lua
function input.mouse_position(): vec2input.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): boolinput.get_clipboard_text
Get the text in your clipboard.
lua
function input.get_clipboard_text(): stringinput.set_clipboard_text
Set your clipboard text.
lua
---@param str string
function input.set_clipboard_text(str): nilTypes
input_keyboard_state
| Field | Type |
|---|---|
pressed | bool |
just_pressed | bool |
just_released | bool |
name | string |
input_mouse_state
| Field | Type |
|---|---|
double_clicked | bool |
pressed | bool |
just_pressed | bool |
just_released | bool |
name | string |
input_pad_state
| Field | Type |
|---|---|
pressed | bool |
just_pressed | bool |
just_released | bool |
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)