GetAsyncKeyState

Gets the raw key state using the Windows GetAsyncKeyState function.

Syntax

Susano.GetAsyncKeyState(vk) -> down, pressed

Parameters

vk (integer): Windows virtual-key code (e.g. 0x41 = A, 0xA0 = VK_LSHIFT).

Return(s)

down (boolean): true if the key is currently held.

pressed (boolean): true if the key transitioned from up → down since the last OS query.

Example(s)

-- A key (0x41)
local down, pressed = Susano.GetAsyncKeyState(0x41)
if pressed then print("A pressed") end
if down then   print("A held")    end

Last updated