circle(x, y, d);Draw a circle on the screen.
Arguments
xThe x position of the circleyThe y position of the circledThe diameter of the circlefunction setup()
  createWindow(200, 200);
end
function draw()
  background('purple');
 
  circle(100, 100, 32);
end
Output
ellipse(x, y, w, h);Draw an ellipse on the screen.
Arguments
xThe x position of the ellipseyThe y position of the ellipsewThe width diameter of the ellipsehThe height diameter of the ellipsefunction setup()
  createWindow(200, 200);
end
function draw()
  background('purple');
 
  ellipse(100, 100, 64, 32);
endOutput
rect(x, y, w, h);Draw a rectangle on the screen.
Arguments
xThe x position of the rectangleyThe y position of the rectanglewThe widthhThe heightfunction setup()
  createWindow(200, 200);
end
function draw()
  background('purple');
 -- rectangle near the top-left corner
  rect(30, 30, 120, 80); 
endOutput
square(x, y, s);Draw a square on the screen.
Arguments
xThe x position of the squareyThe y position of the squaresThe size of the squarefunction setup()
  createWindow(200, 200);
end
function draw()
  background('purple');
  -- square near the top-left corner
  rect(30, 20, 64);
endOutput
line(x1, y1, x2, y2);Draw a line on the screen.
Arguments
x1The x position of the first pointy1The y position of the first pointx2The x position of the second pointy2The y position of the second pointfunction setup()
  createWindow(200, 200);
end
function draw()
  background('purple');
  stroke('white');
  -- diagonal line from top-left to mouse pointer
  line(0, 0, mouseX, mouseY);
endOutput
arc(x, y, w, h, start, stop);Draw an arc on the screen.
Arguments
xThe x position of the arcyThe y position of the arcwThe width of the archThe height of the arcstartThe angle to start the arcstopThe angle to stop the arcfunction setup()
    createWindow(200, 200);
end
function draw()
    background('purple');
    
    local angle = map(mouseX, 0, width, PI, TWO_PI);
    arc(100, 100, 64, 64, 0, angle);
endOutput
point(x, y);Draw a point on the screen.
Arguments
xThe pointyThe pointUse stroke to set the point's color, and use strokeWeight to set the point's radius.
Setting the color with fill will not affect point
function setup()
    createWindow(200, 200);
end
function draw()
    background('purple');
    strokeWeight(4);
    stroke('white');
    point(width/2, height/2);
endOutput
quad(x1, y1, x2, y2, x3, y3, x4, y4);Draw a quad on the screen.
Arguments
x1The x position of the first pointy1The y position of the first pointx2The x position of the second pointy2The y position of the second pointx3The x position of the third pointy3The y position of the third pointx4The x position of the fourth pointy4The y position of the fourth pointfunction setup()
  createWindow(200, 200);
end
function draw()
  background('purple');
  quad(30, 60, 160, 50, 130, 165, 40, 145);
endOutput
triangle(x1, y1, x2, y2, x3, y3);Draw a triangle on the screen.
Arguments
x1The x position of the first pointy1The y position of the first pointx2The x position of the second pointy2The y position of the second pointx3The x position of the third pointy3The y position of the third pointfunction setup()
    createWindow(200, 200);
end
function draw()
    background('purple');
    triangle(50, 150, 100, 50, 150, 150);
endOutput
beginShape([mode]);Begin adding vertices to a custom shape.
Arguments
[mode]The opengl shape mode LINES, POINTS, QUADS, TRIANGLES, TRIANGLE_FAN , default is LINESThe mode param is not completely implemented in lu5-wasm
function setup()
  createWindow(300, 300);
end
function draw()
  background('purple');
  beginShape();
    vertex(150,  50);
    vertex(170, 130);
    vertex(250, 130);
    vertex(185, 170);
    vertex(210, 250);
    vertex(150, 200);
    vertex( 90, 250);
    vertex(115, 170);
    vertex( 50, 130);
    vertex(130, 130);
  endShape();
endOutput
vertex(x, y);Add a vertex to a custom shape.
Arguments
xThe x positionyThe y positionbeginShape must be called prior.