Discord
Login
Community
DARK THEME

buttons

how can i use mouse.left for text only?

update = function()
   if mouse.left then 
     print( text[line] )
     line += 1
   end
end

i formed my question incorrectly, sorry. How can I use mouse.left only in coordinates? ex mouse.left in range from 24, 24, to 35, 35.

Your question is still not very clear to me, the mouse has just one global location, which you have with:

mouse.x
mouse.y

Whether the left button is currently pressed or not can be checked with:

mouse.left

thanks a lot!

Just check mouse.x and mouse.y! For example:

if mouse.x > 10 and mouse.x < 30 and mouse.y > 50 and mouse.y < 100 and mouse.left then
  (do something)
end

There are more space-efficient ways to do this, like with checking if the absolute value of the distance between two x values is less than a specific value, but this will work just fine and be easy to read :)

Post a reply

Progress

Status

Preview
Cancel
Post
Validate your e-mail address to participate in the community