RegisterInput
Inputs are buttons events that handle both key press and release states. They must be registered using registerInput()
at root level, outside of any event, in the init.lua
file.
The button state (press/release) is defined in the first argument passed to the callback.
Definition
Alternative Usage
You can register an Input and make it behave like a Hotkey. This method is more reactive as it triggers on key press, when a Hotkey is triggered on release.
Usage Note
It is important to check the keypress
argument inside the callback. Otherwise the code will be executed twice:
One time when the key is pressed
A second time when released
Usage Example
Activate slow motion effect as long as the input key is pressed:
init.lua
Advanced Example
Continuously give money as long as the input key is pressed:
This example use the onUpdate event, which is triggered continuously. Make sure to check the documentation before any modification.
init.lua
Last updated