keyboard.isdown(key)function
Checks if a key is down.
Parameters
key
Astring or a number that represents the key to be checked for down position. See the list of supported key codes.
Return value
This functiontrue 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()