ui.monitors readonly property


Retrieves the characteristics of all the active display monitors, as an integer indexed table.
Each entry value is a table containing the following fields :

  • "name" : a string representing the display name
  • "width" : the monitor physical width as a number
  • "height" : the monitor physical height as a number
  • "primary" : a boolean indicating if the monitor is the primary display

Example

local ui = require "ui" local win = ui.Window("ui.monitors example", 320, 200) local tree = ui.Tree(win, {}) tree.align = "all" tree.style = "icons" tree.border = false for monitor in each(ui.monitors) do local item = tree:add(monitor.name) item:loadicon("shell32.dll", 16) item:add("width : "..monitor.width) item:add("height : "..monitor.height) item:add("primary : "..tostring(monitor.primary)) end ui.run(win):wait()