keyboard.ispressed(key1, [key2], ...)

Checks if one or more keys have been pressed.

Parameters

key1, [key2], ...

One ore more string or a number that represents the keys to be checked for keypress. See the list of supported key codes.

Return value

This function true if all keys have been pressed or false otherwise.

Example

local kb = require "keyboard" local ui = require "ui" local win = ui.Window("Press key A, B and C simultaneously", 400, 280) local lbl = ui.Label(win, "Keys A+B+C have been pressed !") lbl:center() lbl:hide() ui.run(win) async(function() while win.visible do sleep() if kb.ispressed("A", "B", "C") then lbl:show() sleep(1000) elseif lbl.visible then lbl:hide() end end end) waitall()