console.readmouse()

Wait for the mouse to move or click inside the console.

Return value

Returns three values :
  • A number corresponding to the column position in the console when the mouse event occured.
  • A number corresponding to the line position in the console when the mouse event occured.
  • A string value that indicates the mouse button that was pressed or nil if the mouse only moved (without a click). Possibles values are "left", "middle" or "right"

    Example

    local console = require "console" console.color = "cyan" console.writeln("Please click anywhere in the console...") local x, y, button = console.readmouse() console.write("You pressed ") console.writecolor("lightgreen", button) console.write(" at position",x,':',y)