Notes
- This function don't manage diacratics/accentued characters.
- If the character is not represented by a key, this function will return a
nil
value.
keyboard.keyname(char)
Gets the key name corresponding to the provided character.
Parameters
char
Astring
with a single character from which the corresponding key on the keyboard will be guessed.
Return value
This function returns four values if a physical key represents the specified character :string
representing the key name.boolean
value that indicates if the SHIFT
should be pressed.boolean
value that indicates if the CONTROL
should be pressed.boolean
value that indicates if the MENU
should be pressed.Example
local kb = require "keyboard"
-- prints on french and italian keyboards : "0" false true true
-- prints on other keyboards : "2" true false false
print(kb.keyname("@"))