console.readchar()
Reads a key from the console and returns a corresponding character if possible. That function can read special keys (Function keys, arrows...).
Return value
Returns two values :- A string corresponding to the pressed character (for example "A" if SHIFT+A have been pressed).
- A boolean value that indicates if the key pressed is special (for example, UP arrow key returns the string "H" and true).
Example
local console = require "console" console.writecolor("cyan", "Press a key\n") local char, isspecial = console.readchar() if isspecial == true then print("You have pressed special key ["..char.."]") else print("You have pressed key ["..char.."]") end