keyboard.isdown(key)function

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

--! luart-extensions import 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() await win:showasync() async(function() while win.visible do sleep() lbl.visible = keyboard.isdown("SPACE") end end) waitall()