diff --git a/LUA-Events.md b/LUA-Events.md index 817d808..3992038 100644 --- a/LUA-Events.md +++ b/LUA-Events.md @@ -27,17 +27,17 @@ profile profile, profileUpdatingEventArgs eventArgs -- This function will be called after every profile update, before every profile draw. function updateHandler(profile, eventArgs) -- In this example we only want to update once per frame when the keyboard is updated - if eventArgs.DeviceType != "keyboard" then - return - end - - -- The Event Arguments are inside the eventArgs parameter + if not (eventArgs.DeviceType == "keyboard") then + return + end + + -- The Event Arguments are inside the eventArgs parameter -- In a Windows Profile, you could do this: - local currentSong = eventArgs.DataModel.Spotify.SongName; + local currentSong = eventArgs.DataModel.Spotify.SongName end -- Subscribe to the event AFTER defining the function which must be subscribed. -Events.DeviceDrawing.add(updateHandler); +Events.DeviceDrawing.add(updateHandler) ``` --- @@ -60,17 +60,17 @@ profile profile, profileDrawingEventArgs eventArgs -- This function will be called after every profile draw. function drawHandler(profile, eventArgs) -- In this example we only want to draw to the keyboard - if eventArgs.DeviceType != "keyboard" then - return - end + if not (eventArgs.DeviceType == "keyboard") then + return + end - -- The Event Arguments are inside the eventArgs parameter + -- The Event Arguments are inside the eventArgs parameter -- In a Windows Profile, you could do this: - local currentSong = eventArgs.DataModel.Spotify.SongName; + local currentSong = eventArgs.DataModel.Spotify.SongName end -- Subscribe to the event AFTER defining the function which must be subscribed. -Events.DeviceDrawing.add(drawHandler); +Events.DeviceDrawing.add(drawHandler) ``` --- @@ -89,9 +89,9 @@ profile profile, keyPressEventArgs eventArgs ```lua -- This function will be called after every key press. function keyHandler(profile, eventArgs) - print("You pressed: " .. eventArgs.Key); + print("You pressed: " .. eventArgs.Key) end -- Subscribe to the event AFTER defining the function which must be subscribed. -Events.KeyboardKeyPressed.add(keyHandler); +Events.KeyboardKeyPressed.add(keyHandler) ``` \ No newline at end of file