Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

iui.button

A widget that performs an action when pushed.

wasPressed = iui.button(name)

Arguments

NameTypeDescription
namestringThe ID. Displayed as the button’s text.

Returns

NameTypeDescription
wasPressedbooleanWhether the button was pushed this frame.

Overview

Buttons take their label as an argument, and return true when they’re pressed. You should invoke the button’s action whenever it returns true. The typical code pattern for a button is to wrap it in an if statement.

if iui.button("Say Hello") then
	print("Hello, World!")
end