Keys
Provides functions for working with key names and codes.
Accessing the Module
Shared
get_keys()
Returns the full key list as a table.
Parameters
None
Returns
table
: A mapping of key names to key codes.
Example
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, ornil
if not.
Example
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, ornil
if not.
Example
print_key_list()
Prints the full list of key names and codes to the console.
Parameters
None
Returns
None
Example
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
Last updated