Difference between revisions of "Lua:createHotkey"
Jump to navigation
Jump to search
(Initial page creation.) |
m (Added related function template.) |
||
| (One intermediate revision by the same user not shown) | |||
| Line 25: | Line 25: | ||
===Examples=== | ===Examples=== | ||
| − | < | + | <syntaxhighlight lang="lua" line> |
local hotkey = createHotkey(function() | local hotkey = createHotkey(function() | ||
showMessage("Hotkey pressed") | showMessage("Hotkey pressed") | ||
end, VK_F1) | end, VK_F1) | ||
| − | </ | + | </syntaxhighlight> |
{{LuaSeeAlso}} | {{LuaSeeAlso}} | ||
| + | |||
| + | {{Creation}} | ||
Latest revision as of 23:55, 26 June 2026
Creates and registers a GenericHotkey.
A hotkey accepts at most five keys. Pass keys as separate arguments or as a table.
Function Parameters[edit]
| Parameter | Type | Description |
|---|---|---|
| callback | Function | Function to run when the key combination is pressed. |
| keys | Integer or table | One to five virtual-key codes, supplied separately or in a table. |
Returns[edit]
GenericHotkey — The initialized hotkey object.
Examples[edit]
1 local hotkey = createHotkey(function()
2 showMessage("Hotkey pressed")
3 end, VK_F1)