Skip to content

Lua Script API: Game Input Control Functions

Meme1079 edited this page Dec 25, 2024 · 1 revision

Keys & Keyboard Press Functions

keyJustPressed(keybind:String = ''):Bool

Checks whether the given keybind that was initially pressed.

  • keybind - The given keybind to check its input.

keyPressed(keybind:String = ''):Bool

Checks whether the given keybind that was currently held during a pressed.

  • keybind - The given keybind to check its input.

keyReleased(keybind:String = ''):Bool

Checks whether the given keybind that was recently released after being pressed.

  • keybind - The given keybind to check its input.

keyboardJustPressed(key:String):Bool

Checks whether the given keyboard keys were initially pressed.

  • key - The given key from the keyboard to check its input.

keyboardPressed(key:String):Bool

Checks whether the given keyboard keys were currently held during a pressed.

  • key - The given key from the keyboard to check its input.

keyboardReleased(key:String):Bool

Checks whether the given keyboard keys were recently released after being pressed.

  • key - The given key from the keyboard to check its input.

Mouse functions

Note

The mouse can either use these buttons: left, middle or right within the button parameter.

mouseClicked(?button:String = 'left'):Bool

Checks whether the mouse were initially clicked.

  • button - An optional value, the given mouse button to check its input; Default value: left.

mousePressed(?button:String = 'left'):Bool

Checks whether the mouse were currently pressed during a click.

  • button - An optional value, the given mouse button to check its input; Default value: left.

mouseReleased(?button:String = 'left'):Bool

Checks whether the mouse were recently released after being clicked.

  • button - An optional value, the given mouse button to check its input; Default value: left.

Gamepad Functions

Buttons

Note

The parameters for each callback in this section are listed here. Due to stupid, repetitive copy and paste in each callback description. They all work the same as usual in each callback, If you want to know which parameters are included or not, look at each callbacks title, idiot.

  • id - The specified controller ID number used for differentiate controllers. For example, if $4$ gamepads are connected, their IDs will range from 0 to 3 respectively.
  • gamepadBinds - The given buttons from the gamepad to check its input.

gamepadJustPressed(id:Int, gamepadBinds:String):Bool

Checks whether the given gamepad binds were initially pressed.

gamepadPressed(id:Int, gamepadBinds:String):Bool

Checks whether the given gamepad binds were currently held during a pressed.

gamepadReleased(id:Int, gamepadBinds:String):Bool

Checks whether the given gamepad binds were recently released after being pressed.


anyGamepadJustPressed(button:String):Bool

Checks whether the given gamepad buttons were initially pressed.

  • button - The given button from the gamepad to check its input.

anyGamepadPressed(button:String):Bool

Checks whether the given gamepad buttons were currently held during a pressed.

  • button - The given button from the gamepad to check its input.

anyGamepadReleased(button:String):Bool

Checks whether the given gamepad buttons were recently released after being pressed.

  • button - The given button from the gamepad to check its input.

Analog

gamepadAnalogX(id:Int, ?leftStick:Bool = true):Float

Gets the analog stick's current x-axis value.

  • id - The specified controller ID number used for differentiate controllers. For example, if $4$ gamepads are connected, their IDs will range from 0 to 3 respectively.
  • leftStick - An optional parameter, whether the it will be the left or right analog stick; Default value: true.

gamepadAnalogY(id:Int, ?leftStick:Bool = true):Float

Gets the analog stick's current y-axis value.

  • id - The specified controller ID number used for differentiate controllers. For example, if $4$ gamepads are connected, their IDs will range from 0 to 3 respectively.
  • leftStick - An optional parameter, whether the it will be the left or right analog stick; Default value: true.

See Also

Clone this wiki locally