feat(keybinds): add keybinds docs (#55)

This commit is contained in:
Dominic authored and GitHub committed 2022-10-15 10:08:38 +11:00
1 parent 99b434663f
commit 151d264874
1 file changed
+33
+33
View File
@@ -0,0 +1,33 @@
```lua
lib.addKeybind(data)
```
* data: `table`
* name: `string`
* description: `string`
* defaultKey?: `string`
* Default: None
* keybind: `string`
* disabled?: `boolean`
* disable?: `function`(self: `table`, toggle: `boolean`)
* onPressed?: `function`(self: `table`)
* onReleased?: `function`(self: `table`)
```lua
local keybind = lib.addKeybind({
name = 'respects',
description = 'press F to pay respects',
defaultKey = 'F',
onPressed = function(self)
print(('pressed %s (%s)'):format(self.keybind, self.name))
end,
onReleased = function(self)
print(('released %s (%s)'):format(self.keybind, self.name))
end,
})
```
Keybinds can be enabled/disabled by using the disable method.
```lua
keybind:disable(true) -- disable
keybind:disable(false) -- enable
```