Lua:isKeyPressed

From Cheat Engine
Jump to navigation Jump to search

<> Lua API Reference

function isKeyPressed(Key) : Boolean

Returns true if the specified key is currently pressed.

Function Parameters

Parameter Type Description
Key Integer or Virtual-Key Code The virtual key code of the key to check (e.g., VK_F1, VK_SHIFT).

Returns

Boolean — true if the key is pressed, false otherwise.

Examples

1 if isKeyPressed(VK_SPACE) then
2   print("Spacebar is currently pressed!")
3 end
4 
5 if isKeyPressed(VK_LSHIFT) then
6   print("Left Shift is pressed")
7 end

Main Pages

Core Lua documentation entry points

Lua
Script Engine

Mouse Related Functions

Keyboard Related Functions

Global Hotkey Related Functions