Skip to main content
Version: latest - a1.7.0 βš–οΈ

πŸ•ΉοΈ Input

Create custom Bindings and Retrieve Input information

info

🟧 Authority: This 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.

caution

This Class is experimental, so you can try it out and provide feedback before it's full release!

Usage​

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 Game
UnbindUnbinds a Input function
RegisterRegisters a BindingName to a Key
UnregisterUnregisters a BindingName
stringGetKeyIconGets the icon Path of a Key
stringGetMappedKeyReturns the Key given a BindingName
ResetBindingsResets all Bound functions by this Package
tableGetGameKeyBindingsReturns a table with all Game KeyBindings
tableGetScriptingKeyBindingsReturns a table with all Scripting KeyBindings

Bind​

Binds a function to an Input defined using Register or from Game

Input.Bind(binding_name, input_event, callback)
TypeParameterDescription
stringbinding_nameThe KeyBinding ID
InputEventinput_eventWhich Event to register (Released/Pressed)
functioncallbackThe function to trigger

Unbind​

Unbinds all Input functions related to that binding_name and input_event

Input.Unbind(binding_name, input_event)
TypeParameterDescription
stringbinding_nameThe KeyBinding ID
InputEventinput_eventWhich Event to register (Released/Pressed)

Register​

Registers a BindingName to a default Key

Input.Register(binding_name, key_name)
TypeParameterDescription
stringbinding_nameThe KeyBinding ID
stringkey_name

Unregister​

Unregisters a BindingName

Input.Unregister(binding_name, key_name)
TypeParameterDescription
stringbinding_nameThe KeyBinding ID
stringkey_name

GetKeyIcon​

Gets the Icon image path from a Key

Returns string

Input.GetKeyIcon(key_name, dark_mode)
TypeParameterDefaultDescription
stringkey_name
booleandark_modefalse

GetMappedKey​

Gets the Key given a BindingName

Returns string

Input.GetMappedKey(binding_name)
TypeParameterDescription
stringbinding_nameThe KeyBinding ID

ResetBindings​

Resets all Bound functions from this Package

Input.ResetBindings()

GetScriptingKeyBindings​

Returns a table with all Scripting KeyBindings

Returns a table

Input.GetScriptingKeyBindings()

GetGameKeyBindings​

Returns a table with all Game KeyBindings

Returns a table

Input.GetGameKeyBindings()