on.mouse_press = function(x,y, mouse_button) if mouse_press_consumed_by_any_button(Buttons, x,y, mouse_button) then return end if x >= X and x < X+Square_side and y >= Y and y < Y+Square_side then Cursor = {1, 1} elseif x >= X+Square_side and x < X+Square_side*2 and y >= Y and y < Y+Square_side then Cursor = {2, 1} elseif x >= X and x < X+Square_side and y >= Y+Square_side and y < Y+Square_side*2 then Cursor = {1, 2} elseif x >= X+Square_side and x < X+Square_side*2 and y >= Y+Square_side and y < Y+Square_side*2 then Cursor = {2, 2} else Cursor = {0, 0} -- invalid end if Cursor[1] ~=0 then -- ensure keyboard is out in mobile devices love.keyboard.setTextInput(true) end end