Difference between revisions of "Lua:keyDown"
Jump to navigation
Jump to search
m |
m (Added CodeBox Template.) |
||
| Line 1: | Line 1: | ||
[[Category:Lua]] | [[Category:Lua]] | ||
| − | '''function''' keyDown(''Key'') | + | {{CodeBox|'''function''' keyDown(''Key'')}} |
Causes the specified key to go into the "down" (pressed) state. | Causes the specified key to go into the "down" (pressed) state. | ||
| Line 9: | Line 9: | ||
!align="left"|Parameter | !align="left"|Parameter | ||
!align="left"|Type | !align="left"|Type | ||
| − | !style="width: | + | !style="width: 60%;background-color:white;" align="left"|Description |
|- | |- | ||
|Key | |Key | ||
| Line 25: | Line 25: | ||
</pre> | </pre> | ||
| − | + | {{LuaSeeAlso}} | |
| − | + | ||
| − | + | {{KeyboardMouse}} | |
| − | |||
| − | |||
Latest revision as of 23:55, 4 December 2025
| <> Function function keyDown(Key) |
Causes the specified key to go into the "down" (pressed) state. This simulates pressing and holding the key.
Function Parameters[edit]
| Parameter | Type | Description |
|---|---|---|
| Key | Integer or Virtual-Key Code | The virtual key code of the key to press down (e.g., VK_F1, VK_SHIFT).
|
Examples[edit]
-- Simulate pressing and holding the left control key keyDown(VK_LCONTROL) -- Simulate pressing and holding the "A" key keyDown(VK_A)
See also[edit]
| Lua |
| Script Engine |
Related Functions[edit]
| getMousePos |
| setMousePos |
| isKeyPressed |
| keyDown |
| keyUp |
| doKeyPress |
| mouse_event |
| setGlobalKeyPollInterval |
| setGlobalDelayBetweenHotkeyActivation |