From 5eafe25b1af86718a9c62f38acb551652bd98caa Mon Sep 17 00:00:00 2001 From: Gabriel Tofvesson Date: Thu, 14 Nov 2024 03:02:31 +0000 Subject: [PATCH] Add char event utils --- gfx/event.lua | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/gfx/event.lua b/gfx/event.lua index 887512f..3f38101 100644 --- a/gfx/event.lua +++ b/gfx/event.lua @@ -8,6 +8,14 @@ function Event.getKeyParams(evt) return evt[2], evt[3] end +function Event.isCharEvent(evt, char) + return evt[1] == "char" and (key == nil or evt[2] == key) +end + +function Event.getCharValue(evt) + return evt[2] +end + function Event.isClickEvent(evt) return evt[1] == "monitor_touch" or evt[1] == "mouse_click" end