From the reference libraryRedM

autodoc_client_functions

jo_libs/modules/raw-keys/autodoc/autodoc_client_functions.md

autodoc_client_functions

JO Functions > jo.rawKeys.getAliasFromStandardKey() > Syntax

jo.rawKeys.getAliasFromStandardKey(key)

JO Functions > jo.rawKeys.getAllVK() > Syntax

jo.rawKeys.getAllVK()

JO Functions > jo.rawKeys.getKeyFromVK() > Syntax

jo.rawKeys.getKeyFromVK(vk)

JO Functions > jo.rawKeys.listen()

Registers a listener for a specific key. When the key is pressed or released, the provided callback function is executed with a boolean value indicating the event state (true for pressed, false for released). <br>

JO Functions > jo.rawKeys.listen() > Syntax

jo.rawKeys.listen(key, callback)

JO Functions > jo.rawKeys.listen() > Parameters

key : string

The identifier of the key to listen for. This should correspond to one of the keys defined in the keyboard mappings (e.g., "A", "B", "F1", etc.) or the numerical key code

callback : function

The function to be executed when the key event occurs. It receives one parameter: <br> booleantrue when the key is pressed, false when it is released.

JO Functions > jo.rawKeys.listen() > Return Value

Type : integer

The unique identifier for the listener, which can be used to remove it later.

JO Functions > jo.rawKeys.listen() > Example

jo.rawKeys.listen("A", function(pressed)
  if pressed then
    print("Key A pressed")
  else
    print("Key A released")
  end
end)


JO Functions > jo.rawKeys.remove()

Removes all listeners associated with the specified key. Use this function to stop listening for events on a key when it is no longer needed. <br>

JO Functions > jo.rawKeys.remove() > Syntax

jo.rawKeys.remove(key)

JO Functions > jo.rawKeys.remove() > Parameters

key : string

The identifier of the key for which the listener should be removed.

JO Functions > jo.rawKeys.remove() > Example

jo.rawKeys.remove("A")


JO Functions > jo.rawKeys.removeListener()

Removes the listener associated with the specified ID. Use this function to stop listening for events on a key when it is no longer needed. <br>

JO Functions > jo.rawKeys.removeListener() > Syntax

jo.rawKeys.removeListener(id)

JO Functions > jo.rawKeys.removeListener() > Parameters

id : string

The ID of the listener to remove.

Back to documentation