Files
Basalt/docs/objects/Object/onClick.md
Robert Jelic 4d614372a1 Updated docs
There is still stuff to do
2022-08-28 18:18:26 +02:00

471 B

onClick

onClick(self, event, button, x, y)
The computercraft event which triggers this method is mouse_click and monitor_touch.

Here is a example on how to add a onClick event to your button:

local basalt = require("basalt")

local main = basalt.createFrame()
local button = main:addButton()
  :setPosition(3,3)
  :setSize(12,3)
  :setText("Click")

function buttonOnClick()
  basalt.debug("Button got clicked!")
end
button:onClick(buttonOnClick)