A button that can be poked/clicked to perform an action.
Every button has a Label. Use label:setText(…) to set it:
my_button.label:setText("this is my button")
onActivated to a function you’d like to be called when the button is pressed:
my_button.onActivated = function() -- do something... end
You can also set the button’s default, highlighted and activated texture (see Surface documentation for image format caveats). Or if you just want a colored button, you can set its color. Set either color or texture to nil to remove that attribute.
my_button = Button(bounds)
|bounds||Bounds||The button’s initial bounds.|
Sets the texture of the button Set to nil to remove the attribute.
|asset||Asset||The texture asset|
Sets the color of the button Set to nil to remove the attribute.
|rgba||table||A table with the desired color’s r, g, b and alpha values between 0-1, e.g. |