From f3f600892d6d3dc78d11a11aa40ec3da99351600 Mon Sep 17 00:00:00 2001 From: Gabriel Tofvesson Date: Thu, 14 Nov 2024 02:32:27 +0000 Subject: [PATCH] Add util function for key events --- gfx/event.lua | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/gfx/event.lua b/gfx/event.lua index ab093db..66c25ae 100644 --- a/gfx/event.lua +++ b/gfx/event.lua @@ -4,6 +4,10 @@ function Event.isClickEvent(evt) return evt[1] == "monitor_touch" or evt[1] == "mouse_click" end +function Event.isKeyEvent(evt, key) + return evt[1] == "key" and (key == nil or evt[2] == key) +end + function Event.getClickParams(evt) return evt[3], evt[4], evt[2] end