Input.getState

loon.input.getState

Function: loon.input.getState
Returns a table containing information about the current input devices, including keyboard, mouse and any gamepads. The table is regenerated each time the function is called, so it is recommended to store the table in a local variable for use, and only regenerate at the start of each update loop.

Usage
Structure of the table: 


 * pad[1..n]


 * Contains tables for each connected gamepad. Axis in the format pad[n].axis_lx / axis_ly / axis_rx / axis_ry. Buttons in the format pad[n].button0 through button15




 * keyheld


 * Indicates currently held keys on the keyboard.




 * keydown


 * Indicates keys pressed during the last poll.




 * keyup


 * Indicates keys released during the last poll.

recognised key labels: escape space apostraphe backspace comma minus period forwardslash backslash equals leftsquarebracket rightsquarebracket singlequote semicolon delete key_0 through key_9 key_a through key_z

example: input = loon.input.getState --generates the state table if input.keyheld.key_a == 1 or input.pad[1].button10 == 1 then dosomething elseif input.keydown.escape == 1 then shutdown end