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

Get Button State

The km.[button_name]() command is used to read the state of any of the mouse buttons.

By replacing button_name with the name of any button, as defined in the Buttons section, this command can be used for all buttons.

Examples

Reading the Left Button’s State

Input:

km.left()

Output:

km.left()
1            # The Left Button in this case was pressed (1).
>>>

Reading the Front Side Button’s State

Input:

km.side2()

Output:

km.side2()
0            # The Front Side Button in this case was released (0).
>>>