RegisterHotkey
Hotkeys are buttons events triggered on key release. They must be registered using registerHotkey() at root level, outside of any event, in the init.lua file.
Definition
registerHotkey(slug, label, callback)--
-- registerHotkey()
--
-- @param string slug The internal slug (must be unique in your mod scope)
-- @param string label The label displayed in CET Bindings
-- @param function callback The callback function
--
registerHotkey('slug', 'label', function()
-- hotkey is released
end)Usage Example
Give money with a hotkey:
registerHotkey('give_money', 'Give Money', function()
Game.AddToInventory('Items.money', 1000)
end)Last updated