2023-06-22 01:03:27 +02:00
|
|
|
local input = {
|
2023-06-22 00:36:51 +02:00
|
|
|
keys = require("keys"),
|
|
|
|
}
|
2023-06-15 19:42:34 +02:00
|
|
|
|
|
|
|
---Set a keybind. If called on an already existing keybind, it gets replaced.
|
|
|
|
---@param key Keys The key for the keybind. NOTE: uppercase and lowercase characters are considered different.
|
|
|
|
---@param modifiers Modifiers[] Which modifiers need to be pressed for the keybind to trigger.
|
2023-06-19 02:30:52 +02:00
|
|
|
---@param action fun() What to run.
|
2023-06-22 01:03:27 +02:00
|
|
|
function input.keybind(modifiers, key, action)
|
2023-06-15 19:42:34 +02:00
|
|
|
table.insert(CallbackTable, action)
|
|
|
|
SendMsg({
|
|
|
|
SetKeybind = {
|
|
|
|
modifiers = modifiers,
|
|
|
|
key = key,
|
|
|
|
callback_id = #CallbackTable,
|
|
|
|
},
|
|
|
|
})
|
|
|
|
end
|
|
|
|
|
2023-06-22 01:03:27 +02:00
|
|
|
return input
|