Skip to main content

Keybinds

A global API containing a function to create new Keybind instances

warning

This page is a WIP. It contains all the information in Figura's documentation but we're working on adding more helpful descriptions.


newKeybind()

Aliases: of()

Creates and returns a new Keybind

The name is used in the keybind menu

The key parameter is an identifier for a key, such as "key.keyboard.r"

The boolean gui indicates whether the keybind should always work, or if it should only work when you don't have a screen open

Check the docs enum command for all key names

newKeybind(name, key, gui)

Parameters:

NameTypeDescriptionDefault
nameString--
keyString--
guiBoolean--

Returns:

TypeDescription
Keybind-

Example:

local myKey = keybinds:newKeybind("Name", "key.keyboard.h", false)

getVanillaKey()

Gets the id of the key bound to the given action, as a string

Check the docs enum command for all key names and vanilla actions

getVanillaKey(id)

Parameters:

NameTypeDescriptionDefault
idString--

Returns:

TypeDescription
String-

Example:

local myKey = keybinds:newKeybind("Name", keybinds:getVanillaKey("key.attack"), false)

fromVanilla()

Creates a new Keybind based from a vanilla key

fromVanilla(id)

Parameters:

NameTypeDescriptionDefault
idString--

Returns:

TypeDescription
Keybind-

Example:

local myKey = keybinds:fromVanilla("key.attack")

getKeybinds()

Returns a table with all registered keybinds

getKeybinds()

Returns:

TypeDescription
Table-

Example:

keybinds:getKeybinds()