CorsixTH Lua Documentation

Button Class

A region of a `Panel` which causes some action when clicked.

Declared on: line 594 of Lua/window.lua.

Method Index

Member Index

function Button:enable(enable)

Enable or disable a button.

Parameters:

NameTypeDescription
enable boolean Whether to enable (true) or disable (false) the button.

Declared on: line 628 of Lua/window.lua.

function Button:handleClick(mouse_button)

this or another button). However for repeat buttons, it is called once on MouseDown and, after

a short delay, repeatedly.

Parameters:

NameTypeDescription
mouse_button string either "left" or "right"

Declared on: line 721 of Lua/window.lua.

function Button:setDisabledSprite(index)

Parameters:

NameTypeDescription
index ? ?

Declared on: line 623 of Lua/window.lua.

function Button:setDynamicTooltip(callback, x, y)

Parameters:

NameTypeDescription
callback ? ?
x ? ?
y ? ?

Declared on: line 712 of Lua/window.lua.

function Button:setLabel(label, font, align)

Convenience function to allow setLabel to be called on a button, not only its panel.

see Panel:setLabel

Parameters:

NameTypeDescription
label ? ?
font ? ?
align ? ?

Declared on: line 780 of Lua/window.lua.

function Button:setPosition(x, y)

Set the position of a button.

Parameters:

NameTypeDescription
x int New horizontal position of the button.
y int New vertical position of the button.

Declared on: line 745 of Lua/window.lua.

function Button:setSize(width, height)

Set the size of a button.

Parameters:

NameTypeDescription
width int New width of the button.
height int New height of the button.

Declared on: line 760 of Lua/window.lua.

function Button:setSound(name)

Parameters:

NameTypeDescription
name ? ?

Declared on: line 691 of Lua/window.lua.

function Button:setToggleState(state)

Set the toggle state of the button to the provided state.

Parameters:

NameTypeDescription
state boolean Desired state of the toggle button.

Declared on: line 675 of Lua/window.lua.

function Button:setTooltip(tooltip, x, y)

Specify a tooltip to be displayed when hovering this button. x and y are optional position of bottom left of the tooltip. If not specified, will default to top center of button.

Parameters:

NameTypeDescription
tooltip ? ?
x ? ?
y ? ?

Declared on: line 700 of Lua/window.lua.

function Button:setVisible(visibility)

Set the visibility of the button.

Parameters:

NameTypeDescription
visibility bool New visibility of the button.

Declared on: line 773 of Lua/window.lua.

function Button:toggle()

Flip the toggle state of the button (on -> off, or off -> on).

Declared on: line 663 of Lua/window.lua.