mirror of
https://github.com/Artemis-RGB/Artemis
synced 2026-01-02 10:43:31 +00:00
Created LUA Keybinds (markdown)
parent
faba9d8531
commit
1720ca27f5
55
LUA-Keybinds.md
Normal file
55
LUA-Keybinds.md
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
The Keybind module allows you to execute pieces of script when a certain key or mousebutton is pressed.
|
||||||
|
|
||||||
|
## Overview
|
||||||
|
* [SetKeybind](https://github.com/SpoinkyNL/Artemis/wiki/luakeybinds#setkeybind)
|
||||||
|
* [RemoveKeybind](https://github.com/SpoinkyNL/Artemis/wiki/luakeybinds#removekeybind)
|
||||||
|
|
||||||
|
## Functions
|
||||||
|
### SetKeybind
|
||||||
|
Creates a keybind using the given variables.
|
||||||
|
#### Syntax:
|
||||||
|
```lua
|
||||||
|
SetKeybind(string name, string hotkey, PressType pressType function function, [params]);
|
||||||
|
```
|
||||||
|
##### Required arguments
|
||||||
|
- **name:** A name to identify the keybind by
|
||||||
|
- **hotkey:** A hotkey to bind the keybind to such as "SHIFT+D"
|
||||||
|
- **pressType:** When to trigger, on press up or press down ("Up" or "Down")
|
||||||
|
- **function:** A LUA function to be called each time the keybind is pressed
|
||||||
|
|
||||||
|
##### Optional arguments
|
||||||
|
**Note:** The arguments between [brackets] are optional and you can leave them out.
|
||||||
|
- **params:** Paramaters you wish to pass to the function the timer will call on each keypress
|
||||||
|
|
||||||
|
#### Example:
|
||||||
|
```lua
|
||||||
|
-- Simply call a method
|
||||||
|
function kbTest()
|
||||||
|
print("oohai!");
|
||||||
|
end
|
||||||
|
Keybind.SetKeybind("test1", "SHIFT+D", kbTest);
|
||||||
|
|
||||||
|
-- Call a method with argument(s)
|
||||||
|
function kbTest2(message)
|
||||||
|
print(message);
|
||||||
|
end
|
||||||
|
Keybind.SetKeybind("test2", "SHIFT+F", kbTest2, "hello!!!");
|
||||||
|
```
|
||||||
|
---
|
||||||
|
### RemoveKeybind
|
||||||
|
Removes an existing keybind.
|
||||||
|
```lua
|
||||||
|
RemoveKeybind(string name);
|
||||||
|
```
|
||||||
|
##### Required arguments
|
||||||
|
- **name:** The name of the keybind to remove
|
||||||
|
|
||||||
|
#### Example:
|
||||||
|
```lua
|
||||||
|
function kbTest()
|
||||||
|
-- As a test, remove the keybind after being pressed once
|
||||||
|
Keybind.RemoveKeybind("test");
|
||||||
|
end
|
||||||
|
Keybind.SetKeybind("test", "SHIFT+F", kbTest);
|
||||||
|
```
|
||||||
|
---
|
||||||
Loading…
x
Reference in New Issue
Block a user