Documentation
  • 👋Introduction
  • 📚Guides
    • Useful Links
  • 🆓boii_utils
    • Installation
    • Configuration
    • Modules
    • API
      • Callbacks
      • Characters
      • Commands
      • Cooldowns
      • Debugging
      • Entities
      • Environment
      • Framework Bridge
      • Geometry
      • Items
      • Keys
      • Licences
      • Maths
      • Methods
      • Player
      • Requests
      • Strings
      • Tables
      • Timestamps
      • UI Bridges
      • Vehicles
      • Version
      • XP
      • UI Elements
Powered by GitBook
On this page
  • Accessing the Module
  • Shared
  • get_keys()
  • get_key(key_name)
  • get_key_name(key_code)
  • print_key_list()
  • key_exists(key_name)
  1. boii_utils
  2. API

Keys

Provides functions for working with key names and codes.


Accessing the Module

local KEYS <const> = exports.boii_utils:get("modules.keys")

Shared

get_keys()

Returns the full key list as a table.

Parameters

None

Returns

  • table: A mapping of key names to key codes.

Example

local all_keys = KEYS.get_keys()
print(all_keys["e"]) -- 46

get_key(key_name)

Gets the key code for a given key name.

Parameters

Name
Type
Description

key_name

string

Name of the key (e.g. "e")

Returns

  • number|nil: Key code if found, or nil if not.

Example

local code = KEYS.get_key("f")
if code then
    print("Key code for F is:", code)
end

get_key_name(key_code)

Gets the key name for a given key code.

Parameters

Name
Type
Description

key_code

number

The code to look up

Returns

  • string|nil: The key name if found, or nil if not.

Example

local name = KEYS.get_key_name(244)
if name then
    print("Key 244 is:", name)
end

print_key_list()

Prints the full list of key names and codes to the console.

Parameters

None

Returns

None

Example

KEYS.print_key_list()

key_exists(key_name)

Checks if a given key name exists in the key table.

Parameters

Name
Type
Description

key_name

string

Key name to check

Returns

  • boolean: true if the key exists, false otherwise.

Example

if KEYS.key_exists("enter") then
    print("Enter key exists")
end
PreviousItemsNextLicences

Last updated 1 month ago

🆓