mirror of
https://github.com/Artemis-RGB/Artemis
synced 2025-12-13 05:48:35 +00:00
Created LUA Events (markdown)
parent
ab8c87143b
commit
1587032590
26
LUA-Events.md
Normal file
26
LUA-Events.md
Normal file
@ -0,0 +1,26 @@
|
||||
Within the LUA environment you can use events to react to certain things, such as the profile being updated or key being pressed.
|
||||
|
||||
To use events you need to subscribe to them. You can subscribe to the same event more than once if you want.
|
||||
The examples below show how subscribing works.
|
||||
|
||||
### ProfileDrawing
|
||||
Triggers whenever the profile is being drawn
|
||||
#### Parameters
|
||||
```lua
|
||||
profile profile, profileDrawingEventArgs eventArgs
|
||||
```
|
||||
#### Event Arguments
|
||||
- **DataModel:** An object containing the current DataModel. *(TODO: DataModel explaination)*
|
||||
- **Preview:** A boolean indicating whether the draw was done as a preview (for the editor).
|
||||
- **Drawing:** The [Drawing](https://github.com/SpoinkyNL/Artemis/wiki/Drawing) object for this frame. Use this to draw your own shapes.
|
||||
|
||||
#### Example
|
||||
```lua
|
||||
-- This function will be called after every profile draw.
|
||||
function drawHandler(profile, eventArgs)
|
||||
-- Put your code here
|
||||
end
|
||||
|
||||
-- Subscribe to the event AFTER defining the function which must be subscribed.
|
||||
Events.ProfileDrawing.add(drawHandler);
|
||||
```
|
||||
Loading…
x
Reference in New Issue
Block a user