createWindow(w, h, [mode]);Create a GLFW window.
Arguments
wWindow widthhWindow height[mode]Rendering mode, either GL2D or GL3D, by default GL2D is set.function setup()
  createWindow(100, 100);
end
function draw()
  background('magenta');
  -- draw things
end
Output
noLoop();Prevents lu5 from calling draw again. 
When noLoop is called, the draw continues execution, but will not be called again.
angle = 0;
radius = 100;
function setup()
  createWindow(300, 300);
  
  textAlign(CENTER);
  noStroke();
end
function draw()
  background('purple');
  text('Click to pause', width/2, height/2);
  circle(
    radius * cos(angle) + 150, 
    radius * sin(angle) + 150,
    16
  );
  angle = angle + 0.05;
end
function mousePressed()
  noLoop(); -- Stop loop
end
function mouseReleased()
  loop();
endOutput
loop();Allow lu5 to call the draw function.
angle = 0;
radius = 100;
function setup()
  createWindow(300, 300);
  
  textAlign(CENTER);
  noStroke();
end
function draw()
  background('purple');
  text('Click to pause', width/2, height/2);
  circle(
    radius * cos(angle) + 150, 
    radius * sin(angle) + 150,
    16
  );
  angle = angle + 0.05;
end
function mousePressed()
  noLoop();
end
function mouseReleased()
  loop(); -- Start back the loop
endOutput
frameRate(fps);Set the frame rate.
Arguments
fpsThe frame rate to setIf frame rate is called without an argument, it will return frame per seconds
x = 0;
r = 16;
speed = 50;
function setup()
  createWindow(200, 200);
  frameRate(30); -- Set the frame rate
end
function draw()
  background('purple');
  text('fps: ' .. frameRate(), 20, 30);
  square(x, 100, r);
  if x > width+r then 
    x = -r;
  else
    x = x + speed * deltaTime;
  end
endOutput
x = 0;
r = 16;
speed = 50;
function setup()
  createWindow(200, 200);
  frameRate(12); -- Set the frame rate
end
function draw()
  background('purple');
  text('fps: ' .. frameRate(), 20, 30);
  square(x, 100, r);
  if x > width+r then 
    x = -r;
  else
    x = x + speed * deltaTime;
  end
endOutput
saveWindow(path);Save the current window into an image. Acts as a screenshot.
Arguments
pathThe image path to write to.In this example, press the mouse to save a screenshot of the window.x
function setup()
  createWindow(300, 300);
end
function draw()
  circle(200, 200, 32);
  fill(255, 50, 100);
  square(200, 200, 32);
end
function mousePressed()
  saveWindow("./screenshot.png");
endwidthGlobalThe window's width in pixels. If no window was created, this value is nil.
heightGlobalThe window's height in pixels. If no window was created, this value is nil.
deltaTimeGlobalElapsed time since the last draw call in seconds.
x = 0;
vx = 128;
function setup()
  createWindow(400, 400);
  frameRate(24); -- try with 60
end
function draw()
  background('purple');
  circle(x, height/2, 32);
  -- Get the same velocity with different framerates
  x = x + vx * deltaTime;
endwindowResized();EventCalled when the window is resized.
function setup()
    createWindow(500, 500);
end
function draw()
    background('purple');
end
function windowResized()
    print('Resized!');
end