Jump to content




Need explanation for mouseclicks


  • You cannot reply to this topic
2 replies to this topic

#1 Klausar

  • Members
  • 110 posts

Posted 27 October 2012 - 07:04 AM

So I'm trying to make a program, that when you click somewhere, something happens. But I don't get how to do it. If I click at position 5,6 for example I want something to happen, can someone make a example code and explain it?

#2 Luanub

    Lua Nub

  • Members
  • 1,135 posts
  • LocationPortland OR

Posted 27 October 2012 - 07:08 AM

Use events to caputre where the click took place and use an if statement to check if it was in a location that it needs to do something.
local event, button, mouseX, mouseY = os.pullEvent("mouse_click")
if mouseX == 5 and mouseY == 6 then
--do stuff
end


#3 Klausar

  • Members
  • 110 posts

Posted 27 October 2012 - 08:54 AM

Thank you good sir!





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users