about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--button.lua6
-rw-r--r--main.lua4
2 files changed, 6 insertions, 4 deletions
diff --git a/button.lua b/button.lua
index 10f32ff..cc48b26 100644
--- a/button.lua
+++ b/button.lua
@@ -1,3 +1,5 @@
+-- simple immediate-mode buttons
+
 button_handlers = {}
 
 -- draw button and queue up event handlers
@@ -9,10 +11,10 @@ function button(name, params)
 end
 
 -- process button event handlers
-function propagate_to_button_handlers(x, y, button)
+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 button == 1 then ev.onpress1() end
+      if ev.onpress1 and mouse_button == 1 then ev.onpress1() end
     end
   end
 end
diff --git a/main.lua b/main.lua
index 95bdc50..cd65f2d 100644
--- a/main.lua
+++ b/main.lua
@@ -129,8 +129,8 @@ function love.update(dt)
   Drawing.update(dt)
 end
 
-function love.mousepressed(x,y, button)
-  propagate_to_button_handlers(x,y, button)
+function love.mousepressed(x,y, mouse_button)
+  propagate_to_button_handlers(x,y, mouse_button)
 
   for line_index,line in ipairs(Lines) do
     if line.mode == 'text' then