1
0
mirror of https://github.com/SquidDev-CC/CC-Tweaked synced 2025-12-05 13:58:06 +00:00
Files
CC-Tweaked/doc/events/key_up.md
Jonathan Coates 70a24d371d Update build.gradle to more closely match CC:T's
- Adds cct-javadoc fun and renables checkstyle (yay?)
 - Fixes a few javadoc and formatting issues
 - Cherry pick the docs so illuaminate doesn't complain
2021-11-27 09:32:25 +00:00

754 B

module: [kind=event] key_up see: keys For a lookup table of the given keys.

Fired whenever a key is released (or the terminal is closed while a key was being pressed).

This event returns a numerical "key code" (for instance, F1 is 290). This value may vary between versions and so it is recommended to use the constants in the @{keys} API rather than hard coding numeric values.

Return values

  1. @{string}: The event name.
  2. @{number}: The numerical key value of the key pressed.

Example

Prints each key released on the keyboard whenever a @{key_up} event is fired.

while true do
  local event, key = os.pullEvent("key_up")
  local name = keys.getName(key) or "unknown key"
  print(name .. " was released.")
end