mirror of
https://github.com/darksaid98/overextended.github.io.git
synced 2026-12-01 14:38:50 +00:00
36 lines
835 B
Plaintext
36 lines
835 B
Plaintext
```lua
|
|
lib.addKeybind(data)
|
|
```
|
|
|
|
* data: `table`
|
|
* name: `string`
|
|
* description: `string`
|
|
* defaultKey?: `string`
|
|
* Default: None
|
|
* currentKey: `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.currentKey, self.name))
|
|
end,
|
|
onReleased = function(self)
|
|
print(('released %s (%s)'):format(self.currentKey, self.name))
|
|
end,
|
|
})
|
|
```
|
|
|
|
Keybinds can be enabled/disabled by using the disable method.
|
|
|
|
```lua
|
|
keybind:disable(true) -- disable
|
|
keybind:disable(false) -- enable
|
|
```
|