AwtKeyEvent

Methods
8
Fields
None

Methods

MethodReturnsDescription
getKeyCode()numberThe AWT key code (KeyEvent.VK_*); KeyEvent.VK_UNDEFINED (0) for a KEY_TYPED event.
setKeyCode(number)()Makes the event this key instead: the game sees the new key, or, for a key the client has no code for, nothing.
getExtendedKeyCode()numberThe key code with no keyboard-layout extension: on the layouts the client maps, the key code itself (what Keybind compares).
getKeyChar()stringThe character, a one-character string: what was typed, for a KEY_TYPED event; for a press or release, the character the key makes on a US…
setKeyCharacter(string)()Set the character, as a one-character string (Luau has no char). On a KEY_TYPED event the game types the new character instead; `KeyEve…
getKeyLocation()numberWhere the key is: KeyEvent.KEY_LOCATION_STANDARD, _LEFT (the modifiers: the client does not tell left from right), _NUMPAD, or `_UNKN…
isActionKey()booleanWhether the key types no character: arrows, F1..F24, Home/End, Page Up/Down, Insert, the lock keys, ...
getExtendedKeyCodeForChar(number)numberThe key code for the character c (a code point, e.g. utf8.codepoint(s)), whatever the layout, reached through this class because the `K…

Method details

getKeyCode

getKeyCode: (AwtKeyEvent) -> number

The AWT key code (KeyEvent.VK_*); KeyEvent.VK_UNDEFINED (0) for a KEY_TYPED event.

setKeyCode

setKeyCode: (AwtKeyEvent, number) -> ()

Makes the event this key instead: the game sees the new key, or, for a key the client has no code for, nothing.

getExtendedKeyCode

getExtendedKeyCode: (AwtKeyEvent) -> number

The key code with no keyboard-layout extension: on the layouts the client maps, the key code itself (what Keybind compares).

getKeyChar

getKeyChar: (AwtKeyEvent) -> string

The character, a one-character string: what was typed, for a KEY_TYPED event; for a press or release, the character the key makes on a US layout, or KeyEvent.CHAR_UNDEFINED. A typed character is the one the client's own keyboard handler made: it maps WM_CHAR through a 256-entry table on the low byte, so a character above U+00FF is not the one AWT would report.

setKeyCharacter

setKeyCharacter: (AwtKeyEvent, string) -> ()

Set the character, as a one-character string (Luau has no char). On a KEY_TYPED event the game types the new character instead; KeyEvent.CHAR_UNDEFINED types nothing. Raises for a string that is not one UTF-16 unit.

getKeyLocation

getKeyLocation: (AwtKeyEvent) -> number

Where the key is: KeyEvent.KEY_LOCATION_STANDARD, _LEFT (the modifiers: the client does not tell left from right), _NUMPAD, or _UNKNOWN for a KEY_TYPED event.

isActionKey

isActionKey: (AwtKeyEvent) -> boolean

Whether the key types no character: arrows, F1..F24, Home/End, Page Up/Down, Insert, the lock keys, ...

getExtendedKeyCodeForChar

getExtendedKeyCodeForChar: (number) -> number

The key code for the character c (a code point, e.g. utf8.codepoint(s)), whatever the layout, reached through this class because the KeyEvent name is the constant table here. A letter of either case is its KeyEvent.VK_A..VK_Z, a digit its VK_0..VK_9; a symbol with a code of its own is that (! is VK_EXCLAMATION_MARK, not the 1 key); a character with a key on some layout is 0x01000000 + c; anything else KeyEvent.VK_UNDEFINED.