Difference between revisions of "Lua:isKeyPressed"
Jump to navigation
Jump to search
m |
m |
||
| (One intermediate revision by the same user not shown) | |||
| Line 11: | Line 11: | ||
|- | |- | ||
|Key | |Key | ||
| − | |Integer or [[Virtual-Key | + | |Integer or [[Virtual-Key Code]] |
|The virtual key code of the key to check (e.g., <code>VK_F1</code>, <code>VK_SHIFT</code>). | |The virtual key code of the key to check (e.g., <code>VK_F1</code>, <code>VK_SHIFT</code>). | ||
|} | |} | ||
| Line 33: | Line 33: | ||
* [[keyUp]] | * [[keyUp]] | ||
* [[doKeyPress]] | * [[doKeyPress]] | ||
| − | * [[Virtual Key | + | * [[Virtual-Key Code]] |
Latest revision as of 17:59, 11 July 2025
function isKeyPressed(Key) : Boolean
Returns true if the specified key is currently pressed.
Function Parameters[edit]
| 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[edit]
Boolean — true if the key is pressed, false otherwise.
Examples[edit]
if isKeyPressed(VK_SPACE) then
print("Spacebar is currently pressed!")
end
if isKeyPressed(VK_LSHIFT) then
print("Left Shift is pressed")
end