Skip to content

Latest commit

 

History

History
66 lines (45 loc) · 1.17 KB

screen.md

File metadata and controls

66 lines (45 loc) · 1.17 KB

Screen

The screen library

The screen library provides a way of easily capturing screenshots.

-- Create a new buffer
local screen = require("screen");

screen.capture( )

Capture the entire screen area.

res = screen.capture();
local x = res.x;
local y = res.y;
local w = res.w;
local h = res.h;
local image = res.image;

screen.capture( x, y, w, h, [update] )

Capture the specified screen area.

res = screen.capture(0, 0, 400, 400);
local x = res.x;
local y = res.y;
local w = res.w;
local h = res.h;
local image = res.image;

Optionally it can return only the sub-area that has changed since the previous call. If no pixels have changed since the previous call then the image will be nil. The returned coordinates and size will correspond to the sub-area that has actually changed.

res = screen.capture(0, 0, 400, 400, true);
if (res.image) then
  print("area changed");
else
  print("area same");
end

screen.size( )

Get the screen size.

w,h = screen.size();