keyboard.isdown(key)

Checks if a key is down.

Parameters

key

A string or a number that represents the key to be checked for down position. See the list of supported key codes.

Return value

This function true if the key is down or false otherwise.

Example

local kb = require "keyboard" local ui = require "ui" local win = ui.Window("Press the SPACE key", 400, 280) local lbl = ui.Label(win, "Release the SPACE key to hide this message !") lbl:center() lbl:hide() ui.run(win) async(function() while win.visible do sleep() lbl.visible = kb.isdown("SPACE") end end) waitall()