inkblot

Welcome to your inkblot. You can use the text field below to enter and send Lua scripts that will change what is displayed on your screen. At the bottom of the screen you can get a short list of functions available for drawing.

How to draw

Lua is a very simple language. Here is a brief overview of the syntax: Learn Lua in Y Minutes. You can find a description of the drawing library below.

The screen is monochrome and knows 16 shades. Whenever you see a color below, it can be set to values from 0 (black) to 255 (white). You can also use hexadecimal notation (from 0x00 to 0xFF) which means the same thing.

The coordinate system starts at (0,0) in the top left corner.

local paper = require "paper"
Loads the library to run drawing commands.
paper.init()
Initializes the screen. Needs to be called at least once.
paper.clear()
Clears the screen. If you don't call this, you will draw on top of your previous drawing.
paper.update()
Sends your drawing to the screen. Needs to be called after a sequence of drawing commands to display them..
paper.set_orientation(orientation)
Set the screen orientation. Allowed values for orientation are "portrait", "landscape", "inverse_portrait" and "inverse_landscape"
paper.get_orientation()
Get current screen orientation. Returned values are "portrait", "landscape", "inverse_portrait" and "inverse_landscape"
paper.get_width()
Get current screen width, according to orientation.
paper.get_height()
Get current screen height, according to orientation.
paper.draw_pixel(x, y, color)
Draw a single pixel at (x,y) in the given color.
paper.draw_line(x1, y1, x2, y2, color)
Draw a line from (x1,y1) to (x2,y2) in the given color.
paper.draw_circle(x, y, radius, color) / paper.fill_circle(x, y, radius, color)
Draw an outline around a circle at (x,y) with the given radius in the given color. fill_circle draws the same circle with a solid filling.
paper.draw_rect(x1, y1, x2, y2, color) / paper.fill_rect(x1, y1, x2, y2, color)
Draw an outline around a rectangle with the upper left corner at (x1,y1) and lower right corner at (x2,y2) in the given color. fill_rect draws the same rectangle with a solid filling.
paper.draw_triangle(x1, y1, x2, y2, x3, y3, color) / paper.fill_triangle(x1, y1, x2, y2, x3, y3, color)
Draw an outline around a triangle with corners (x1,y1), (x2,y2) and (x3,y3) in the given color. fill_triangle draws the same triangle with a solid filling.

Have fun!