about summary refs log tree commit diff stats
path: root/button.lua
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2022-08-23 09:40:48 -0700
committerKartik K. Agaram <vc@akkartik.com>2022-08-23 09:40:48 -0700
commitaadc50f3b6d953ce0eaff75dec029aaf3a93324a (patch)
tree67651c0c301a6ea2af18441c4e6ca3ca4814fa67 /button.lua
parent490f10c6f8f38cc83264c38dd93e32d471530880 (diff)
downloadlines.love-aadc50f3b6d953ce0eaff75dec029aaf3a93324a.tar.gz
allow buttons to interrupt events
Most button onpress1 handlers will want to return true.
Diffstat (limited to 'button.lua')
-rw-r--r--button.lua2
1 files changed, 1 insertions, 1 deletions
diff --git a/button.lua b/button.lua
index 5042ae6..66a2c00 100644
--- a/button.lua
+++ b/button.lua
@@ -15,7 +15,7 @@ function propagate_to_button_handlers(x, y, mouse_button)
   for _,ev in ipairs(Button_handlers) do
     if x>ev.x and x<ev.x+ev.w and y>ev.y and y<ev.y+ev.h then
       if ev.onpress1 and mouse_button == 1 then
-        ev.onpress1()
+        return ev.onpress1()
       end
     end
   end