Key.pressed
Revision as of 00:31, 24 March 2020 by 71.226.33.30 (talk) (Created page with "<c>key.pressed</c> detects whether a specific key or button input is currently pressed. See also: key.keyNames; key.axis === Arguments === {| class="wikitable" |-...")
key.pressed
detects whether a specific key or button input is currently pressed.
See also: key.keyNames; key.axis
Arguments
Parameter Name | Default Value | Meaning |
---|---|---|
keyName | string, default "space" | key/button to press |
Usage Notes
These include modifier keys (e.g. "left shift", "right alt") as well as mouse buttons (e.g. "mouse 0") and joystick/gamepad buttons ("joystick 1 button 0", etc.). With regard to joystick buttons, if you don't specify a number (e.g. "joystick button 0"), then it will detect a press of button 0 on *any* joystick. See key.keyNames for all the possible names to use with this method.
Example
while not key.pressed("left"); end while // waits until left arrow pressed