Skip to main content
Version: bleeding-edge 🩸

πŸ•ΉοΈ Input

Create custom keybindings and retrieve input information.

πŸ’‚Authority
This static class can be accessed only on 🟧 Client.
πŸ—ΏStatic Class
This is a Static Class. You can access it's methods directly with .. It is not possible to initialize or create new instances.

πŸŽ’ Examples​

Client/Index.lua
-- Registers the binding_name 'SpawnMenu' with default key 'Q'
-- This will add 'SpawnMenu' to user KeyBinding Settings automatically
Input.Register("SpawnMenu", "Q")

-- Subscribes for Pressing the key
Input.Bind("SpawnMenu", InputEvent.Pressed, function()
-- Opens the Spawn Menu
end)

-- Subscribes for Releasing the key
Input.Bind("SpawnMenu", InputEvent.Released, function()
-- Closes the Spawn Menu
end)

πŸ—Ώ Static Functions​

ReturnsNameDescription
BindBinds a function to an Input defined using Register or from the game
UnbindUnbinds an Input function
RegisterRegisters a keybinding to a default key
UnregisterUnregisters a keybinding
string GetKeyIconGets the icon path of a key
string number GetMappedKeyReturns the key bound to a keybinding
ResetBindingsResets all bound functions by this Package
table GetScriptingKeyBindingsReturns a table with all Scripting KeyBindings

Bind​

Binds a function to an Input defined using Register or from the game
Input.Bind(binding_name, input_event, callback)
TypeParameterDefaultDescription
string binding_nameThe keybinding id
InputEventinput_eventWhich event to register (Released/Pressed)
function callbackThe function to trigger

Unbind​

Unbinds all Input functions related to the given binding_name and input_event
Input.Unbind(binding_name, input_event)
TypeParameterDefaultDescription
string binding_nameThe keybinding id
InputEventinput_eventWhich event to register (Released/Pressed)

Register​

Registers a keybinding to a default key
Input.Register(binding_name, key_name)
TypeParameterDefaultDescription
string binding_nameThe keybinding id
string key_name

Unregister​

Unregisters a keybinding
Input.Unregister(binding_name, key_name)
TypeParameterDefaultDescription
string binding_nameThe keybinding id
string key_name

GetKeyIcon​

Gets the icon path of a key

Returns string ()
local ret = Input.GetKeyIcon(key_name?, dark_mode?)
TypeParameterDefaultDescription
string key_name?
boolean dark_mode?false

GetMappedKey​

Returns the key bound to a keybinding

Returns string number (, )
local ret_01, ret_02 = Input.GetMappedKey(binding_name)
TypeParameterDefaultDescription
string binding_nameThe keybinding id

ResetBindings​

Resets all bound functions by this Package
Input.ResetBindings()

GetScriptingKeyBindings​

Returns a table with all Scripting KeyBindings

Returns table ()
local ret = Input.GetScriptingKeyBindings()