diff --git a/docs/index.html b/docs/index.html index 7474a3a4..55d23384 100644 --- a/docs/index.html +++ b/docs/index.html @@ -1 +1 @@ -Interpreter for Creative Coding | lu5, a Lua Interpreter for Creative Coding

Interpreter for Creative Coding

Lu5 is a free and open-source Lua interpreter for Creative Coding.

Documentation

Builds

\ No newline at end of file +lu5 | Interpreter for Creative Coding

Interpreter for Creative Coding

Lu5 is a free and open-source Lua interpreter for Creative Coding.

Documentation

Builds

\ No newline at end of file diff --git a/docs/latest/classes.html b/docs/latest/classes.html deleted file mode 100644 index a8201937..00000000 --- a/docs/latest/classes.html +++ /dev/null @@ -1,27 +0,0 @@ -classes | lu5, a Lua Interpreter for Creative Coding

classes

v0.0.6
class(name);

Create a class.
if a class implements a print method, it can be used in the print function

Arguments

nameThe class name

 local Player = class('Player');
-
- function Player:init(x, y)
-   self.x = x;
-   self.y = y;
-   return self;
- end
-
- function Player:draw()
-   circle(self.x, self.y, 16);
- end
-
-
- -- Create 2 players and draw them
- local p1 = Player:new(100, 200);
- local p2 = Player:new(300, 200);
-
- function setup()
-   createWindow(400, 400);
- end
- 
- function draw()
-   background(51);
-
-   p1:draw();
-   p2:draw();
- end

\ No newline at end of file diff --git a/docs/latest/classes/index.html b/docs/latest/classes/index.html new file mode 100644 index 00000000..40d714c5 --- /dev/null +++ b/docs/latest/classes/index.html @@ -0,0 +1,27 @@ +lu5 | classes

classes

v0.0.6
class(name);

Create a class.
if a class implements a print method, it can be used in the print function

Arguments

nameThe class name

 local Player = class('Player');
+
+ function Player:init(x, y)
+   self.x = x;
+   self.y = y;
+   return self;
+ end
+
+ function Player:draw()
+   circle(self.x, self.y, 16);
+ end
+
+
+ -- Create 2 players and draw them
+ local p1 = Player:new(100, 200);
+ local p2 = Player:new(300, 200);
+
+ function setup()
+   createWindow(400, 400);
+ end
+ 
+ function draw()
+   background(51);
+
+   p1:draw();
+   p2:draw();
+ end

\ No newline at end of file diff --git a/docs/latest/image.html b/docs/latest/image.html deleted file mode 100644 index 3c7a8112..00000000 --- a/docs/latest/image.html +++ /dev/null @@ -1,10 +0,0 @@ -image | lu5, a Lua Interpreter for Creative Coding

image

v0.0.6
loadImage(path);

Load a png or jpeg image

Arguments

pathThe local image path

Returns

imgThe image reference

 function setup()
-   createWindow(600, 600);
-   img = loadImage('/path/to/mypic.png');
- end
-
- function draw()
-   background(51);
-
-   image(img, 0, 0);
- end   

image(image, x, y, [w], [h]);

Draw an image to the screen

Arguments

imageThe image reference
xThe x position of the image
yThe y position of the image
[w]The width of the image, if not specified, using source width
[h]The height of the image, if not specified, using source height


\ No newline at end of file diff --git a/docs/latest/image/index.html b/docs/latest/image/index.html new file mode 100644 index 00000000..b952ac2a --- /dev/null +++ b/docs/latest/image/index.html @@ -0,0 +1,10 @@ +lu5 | image

image

v0.0.6
loadImage(path);

Load a png or jpeg image

Arguments

pathThe local image path

Returns

imgThe image reference

 function setup()
+   createWindow(600, 600);
+   img = loadImage('/path/to/mypic.png');
+ end
+
+ function draw()
+   background(51);
+
+   image(img, 0, 0);
+ end   

image(image, x, y, [w], [h]);

Draw an image to the screen

Arguments

imageThe image reference
xThe x position of the image
yThe y position of the image
[w]The width of the image, if not specified, using source width
[h]The height of the image, if not specified, using source height


\ No newline at end of file diff --git a/docs/latest/index.html b/docs/latest/index.html index 98e41ce3..7f27fdbb 100644 --- a/docs/latest/index.html +++ b/docs/latest/index.html @@ -1 +1 @@ -Reference | lu5, a Lua Interpreter for Creative Coding

Reference

v0.0.6

classes

\ No newline at end of file +lu5 | Reference

Reference

v0.0.6

classes

\ No newline at end of file diff --git a/docs/latest/io.html b/docs/latest/io.html deleted file mode 100644 index ef72ef64..00000000 --- a/docs/latest/io.html +++ /dev/null @@ -1,9 +0,0 @@ -io | lu5, a Lua Interpreter for Creative Coding

io

v0.0.6
print(value);

Printing utility, can take any lua type.

Arguments

valueThe value to print to stdout

 print(42);
-
- print(1, 2, 3);
- 
- print('Hello world');
-
- print({ 3, 8, 1 });

loadText(file_path);

Read a file as a string

Arguments

file_pathThe path of the file

 file = loadText("./your-file.txt");
- print(file)

loadStrings(file_path);

Read a file as an array of strings split by line

Arguments

file_pathThe path of the file

 file = loadStrings("./your-file.txt");
- print(file)

\ No newline at end of file diff --git a/docs/latest/io/index.html b/docs/latest/io/index.html new file mode 100644 index 00000000..c8a5fedb --- /dev/null +++ b/docs/latest/io/index.html @@ -0,0 +1,9 @@ +lu5 | io

io

v0.0.6
print(value);

Printing utility, can take any lua type.

Arguments

valueThe value to print to stdout

 print(42);
+
+ print(1, 2, 3);
+ 
+ print('Hello world');
+
+ print({ 3, 8, 1 });

loadText(file_path);

Read a file as a string

Arguments

file_pathThe path of the file

 file = loadText("./your-file.txt");
+ print(file)

loadStrings(file_path);

Read a file as an array of strings split by line

Arguments

file_pathThe path of the file

 file = loadStrings("./your-file.txt");
+ print(file)

\ No newline at end of file diff --git a/docs/latest/keyboard.html b/docs/latest/keyboard.html deleted file mode 100644 index b0997ac5..00000000 --- a/docs/latest/keyboard.html +++ /dev/null @@ -1,19 +0,0 @@ -keyboard | lu5, a Lua Interpreter for Creative Coding

keyboard

v0.0.6
keyIsDown(k);

Check if a keyboard key is pressed, returns true if key is down and returns false if it's not

Arguments

kThe keyboard key to check as a key global, or a string

Returns

booleanWhether or not the key is down

 -- Use a string 
- if (keyIsDown('a')) then
-   -- key 'a' is down
- end
-
- -- use a global
- if (keyIsDown(LEFT_ARROW)) then
-   -- left arrow is down
- end

keyPressed(key, keyCode);Event

Called whenever a key is pressed.

Arguments

keyThe pressed key as a string, is nil if glfw cannot find a name for the key
keyCodeThe pressed key as a key code

 function setup()
-    createWindow(600, 600);
- end
- 
- function draw()
-    background(51);
- end
- 
- function keyPressed(key, keyCode)
-    print(key, keyCode)
- end

keyReleased(key, keyCode);Event

Called whenever a key is released.

Arguments

keyThe released key as a string, is nil if glfw cannot find a name for the key
keyCodeThe released key as a key code


keyHeld(key, keyCode);Event

Called whenever a key is held down.

Arguments

keyThe held key as a string, is nil if glfw cannot find a name for the key
keyCodeThe held key as a key code


UP_ARROWGlobal

No description


DOWN_ARROWGlobal

No description


LEFT_ARROWGlobal

No description


RIGHT_ARROWGlobal

No description


KEY_ENTERGlobal

No description


KEY_BACKSPACEGlobal

No description


KEY_AGlobal

No description


KEY_BGlobal

No description


KEY_CGlobal

No description


KEY_DGlobal

No description


KEY_EGlobal

No description


KEY_FGlobal

No description


KEY_GGlobal

No description


KEY_HGlobal

No description


KEY_IGlobal

No description


KEY_JGlobal

No description


KEY_KGlobal

No description


KEY_LGlobal

No description


KEY_MGlobal

No description


KEY_NGlobal

No description


KEY_OGlobal

No description


KEY_PGlobal

No description


KEY_QGlobal

No description


KEY_RGlobal

No description


KEY_SGlobal

No description


KEY_TGlobal

No description


KEY_UGlobal

No description


KEY_VGlobal

No description


KEY_WGlobal

No description


KEY_XGlobal

No description


KEY_YGlobal

No description


KEY_ZGlobal

No description


\ No newline at end of file diff --git a/docs/latest/keyboard/index.html b/docs/latest/keyboard/index.html new file mode 100644 index 00000000..be6de1b9 --- /dev/null +++ b/docs/latest/keyboard/index.html @@ -0,0 +1,19 @@ +lu5 | keyboard

keyboard

v0.0.6
keyIsDown(k);

Check if a keyboard key is pressed, returns true if key is down and returns false if it's not

Arguments

kThe keyboard key to check as a key global, or a string

Returns

booleanWhether or not the key is down

 -- Use a string 
+ if (keyIsDown('a')) then
+   -- key 'a' is down
+ end
+
+ -- use a global
+ if (keyIsDown(LEFT_ARROW)) then
+   -- left arrow is down
+ end

keyPressed(key, keyCode);Event

Called whenever a key is pressed.

Arguments

keyThe pressed key as a string, is nil if glfw cannot find a name for the key
keyCodeThe pressed key as a key code

 function setup()
+    createWindow(600, 600);
+ end
+ 
+ function draw()
+    background(51);
+ end
+ 
+ function keyPressed(key, keyCode)
+    print(key, keyCode)
+ end

keyReleased(key, keyCode);Event

Called whenever a key is released.

Arguments

keyThe released key as a string, is nil if glfw cannot find a name for the key
keyCodeThe released key as a key code


keyHeld(key, keyCode);Event

Called whenever a key is held down.

Arguments

keyThe held key as a string, is nil if glfw cannot find a name for the key
keyCodeThe held key as a key code


UP_ARROWGlobal

No description


DOWN_ARROWGlobal

No description


LEFT_ARROWGlobal

No description


RIGHT_ARROWGlobal

No description


KEY_ENTERGlobal

No description


KEY_BACKSPACEGlobal

No description


KEY_AGlobal

No description


KEY_BGlobal

No description


KEY_CGlobal

No description


KEY_DGlobal

No description


KEY_EGlobal

No description


KEY_FGlobal

No description


KEY_GGlobal

No description


KEY_HGlobal

No description


KEY_IGlobal

No description


KEY_JGlobal

No description


KEY_KGlobal

No description


KEY_LGlobal

No description


KEY_MGlobal

No description


KEY_NGlobal

No description


KEY_OGlobal

No description


KEY_PGlobal

No description


KEY_QGlobal

No description


KEY_RGlobal

No description


KEY_SGlobal

No description


KEY_TGlobal

No description


KEY_UGlobal

No description


KEY_VGlobal

No description


KEY_WGlobal

No description


KEY_XGlobal

No description


KEY_YGlobal

No description


KEY_ZGlobal

No description


\ No newline at end of file diff --git a/docs/latest/math.html b/docs/latest/math/index.html similarity index 52% rename from docs/latest/math.html rename to docs/latest/math/index.html index 620c5c52..c37ff802 100644 --- a/docs/latest/math.html +++ b/docs/latest/math/index.html @@ -1,13 +1,13 @@ -math | lu5, a Lua Interpreter for Creative Coding

math

v0.0.6
randomSeed(seed);

Set a random seed

Arguments

seedThe seed value

Returns

numberThe random value


random(min, max);

Get a random number

Arguments

minThe minimum of the range
maxThe maximum of the range

Returns

numberThe random value

 random()      -- random number between 0 and 1
+lu5 | math

math

v0.0.6
randomSeed(seed);

Set a random seed

Arguments

seedThe seed value

Returns

numberThe random value


random(min, max);

Get a random number

Arguments

minThe minimum of the range
maxThe maximum of the range

Returns

numberThe random value

 random()      -- random number between 0 and 1
  random(3)     -- random number between 0 and 3
  random(3, 12) -- random number between 3 and 12
 
- random({ 'A', 'B', 'C' }) -- random element in table

round(x);

Round a number to the nearest integer

Arguments

xThe value to round

Returns

intThe rounded value


floor(x);

floor is a function that takes in a number, and returns the greatest integer less or equal to x
see here

Arguments

xThe value to floor

Returns

intgreatest integer less than or equals to x


ceil(x);

ceil is a function that takes in a number, and returns the smallest integer greater or equal to x
see here

Arguments

xThe value to floor

Returns

intThe floored value


min(a, b);

Return the smallest value.
Can also take any number of arguments, or a table.

Arguments

aThe first value
bThe second value

Returns

numberThe smallest value

 min(6, 7); -- returns 6
+ random({ 'A', 'B', 'C' }) -- random element in table

round(x);

Round a number to the nearest integer

Arguments

xThe value to round

Returns

intThe rounded value


floor(x);

floor is a function that takes in a number, and returns the greatest integer less or equal to x
see here

Arguments

xThe value to floor

Returns

intgreatest integer less than or equals to x


ceil(x);

ceil is a function that takes in a number, and returns the smallest integer greater or equal to x
see here

Arguments

xThe value to floor

Returns

intThe floored value


min(a, b);

Return the smallest value.
Can also take any number of arguments, or a table.

Arguments

aThe first value
bThe second value

Returns

numberThe smallest value

 min(6, 7); -- returns 6
 
  min(6, 7, 4); -- returns 4
 
- min({ 6, 7, 4 }); -- returns 4

max(a, b);

Return the largest value.
Can also take any number of arguments, or a table.

Arguments

aThe first value
bThe second value

Returns

numberThe largest value

 max(2, 5); -- returns 5
+ min({ 6, 7, 4 }); -- returns 4

max(a, b);

Return the largest value.
Can also take any number of arguments, or a table.

Arguments

aThe first value
bThe second value

Returns

numberThe largest value

 max(2, 5); -- returns 5
 
  max(2, 5, 7); -- returns 7
 
- max({ 2, 5, 7 }); -- returns 7

abs(x);

Returns the absolute value of x which is its distance from 0
see here

Arguments

xThe input value

Returns

numberThe absolote value of the input


map(x, s1, e1, s2, e2);

Maps x from an original range to a target range

Arguments

xThe value to map
s1The start of the initial range
e1The end of the initial range
s2The start of the target range
e2The end of the target range

Returns

numberThe mapped value


dist(x1, y1, x2, y1);

Calculates the distance between 2 points in 2D space

Arguments

x1The x coordinate of the first point
y1The y coordinate of the first point
x2The x coordinate of the second point
y1The y coordinate of the second point

Returns

numberThe distance between the points


constrain(x, min, max);

Limits x to a minimum and maximum value

Arguments

xThe input value
minThe minimum value
maxThe maximum value

Returns

numberThe constrained value


sin(x);

Sine function (Trigonometry)

Arguments

xThe input value

Returns

numberThe output value


cos(x);

Cosine function (Trigonometry)

Arguments

xThe input value

Returns

numberThe output value


tan(x);

Tangent function (Trigonometry)

Arguments

xThe input value

Returns

numberThe output value


PIGlobal

No description


TWO_PIGlobal

No description


HALF_PIGlobal

No description


QUARTER_PIGlobal

No description


\ No newline at end of file + max({ 2, 5, 7 }); -- returns 7

abs(x);

Returns the absolute value of x which is its distance from 0
see here

Arguments

xThe input value

Returns

numberThe absolote value of the input


map(x, s1, e1, s2, e2);

Maps x from an original range to a target range

Arguments

xThe value to map
s1The start of the initial range
e1The end of the initial range
s2The start of the target range
e2The end of the target range

Returns

numberThe mapped value


dist(x1, y1, x2, y1);

Calculates the distance between 2 points in 2D space

Arguments

x1The x coordinate of the first point
y1The y coordinate of the first point
x2The x coordinate of the second point
y1The y coordinate of the second point

Returns

numberThe distance between the points


constrain(x, min, max);

Limits x to a minimum and maximum value

Arguments

xThe input value
minThe minimum value
maxThe maximum value

Returns

numberThe constrained value


sin(x);

Sine function (Trigonometry)

Arguments

xThe input value

Returns

numberThe output value


cos(x);

Cosine function (Trigonometry)

Arguments

xThe input value

Returns

numberThe output value


tan(x);

Tangent function (Trigonometry)

Arguments

xThe input value

Returns

numberThe output value


PIGlobal

No description


TWO_PIGlobal

No description


HALF_PIGlobal

No description


QUARTER_PIGlobal

No description


\ No newline at end of file diff --git a/docs/latest/mouse.html b/docs/latest/mouse.html deleted file mode 100644 index ea296121..00000000 --- a/docs/latest/mouse.html +++ /dev/null @@ -1,50 +0,0 @@ -mouse | lu5, a Lua Interpreter for Creative Coding

mouse

v0.0.6
mouseXGlobal

The x mouse coordinate

 createWindow(400, 400);
-
- function draw()
-   background(51);
-   
-   line(mouseX, 0, mouseX, height);
- end

mouseYGlobal

The y mouse coordinate

 createWindow(400, 400);
-
- function draw()
-   background(51);
-   
-   line(0, mouseY, width, mouseY);
- end

mouseIsPressedGlobal

Is true when the mouse is pressed, is false when it's not


mousePressed(button);Event

Called when a mouse button is pressed.

Arguments

buttonThe pressed mouse button


-In the following example, the circle's size increases when the user clicks the mouse.

 size = 0;
-
- function setup()
-   createWindow(400, 400);
- end
-
- function draw()
-   background(51);
-
-   circle(mouseX, mouseY, size);
- end
-
- -- Increase circle size when mouse pressed
- function mousePressed()
-   size = size + 1;
- end

mouseReleased(button);Event

Called when a mouse button is released.

Arguments

buttonThe released mouse button


-In the following example, the circle's size increases when the user clicks the mouse.

 size = 32;
-
- function setup()
-   createWindow(400, 400);
- end
-
- function draw()
-   background(51);
-
-   circle(mouseX, mouseY, size);
- end
-
- -- Set larger circle size
- function mousePressed()
-   size = 64;
- end
-
- -- Reset size
- function mouseReleased()
-   size = 32;
- end

\ No newline at end of file diff --git a/docs/latest/mouse/index.html b/docs/latest/mouse/index.html new file mode 100644 index 00000000..bb3d7f81 --- /dev/null +++ b/docs/latest/mouse/index.html @@ -0,0 +1,50 @@ +lu5 | mouse

mouse

v0.0.6
mouseXGlobal

The x mouse coordinate

 createWindow(400, 400);
+
+ function draw()
+   background(51);
+   
+   line(mouseX, 0, mouseX, height);
+ end

mouseYGlobal

The y mouse coordinate

 createWindow(400, 400);
+
+ function draw()
+   background(51);
+   
+   line(0, mouseY, width, mouseY);
+ end

mouseIsPressedGlobal

Is true when the mouse is pressed, is false when it's not


mousePressed(button);Event

Called when a mouse button is pressed.

Arguments

buttonThe pressed mouse button


+In the following example, the circle's size increases when the user clicks the mouse.

 size = 0;
+
+ function setup()
+   createWindow(400, 400);
+ end
+
+ function draw()
+   background(51);
+
+   circle(mouseX, mouseY, size);
+ end
+
+ -- Increase circle size when mouse pressed
+ function mousePressed()
+   size = size + 1;
+ end

mouseReleased(button);Event

Called when a mouse button is released.

Arguments

buttonThe released mouse button


+In the following example, the circle's size increases when the user clicks the mouse.

 size = 32;
+
+ function setup()
+   createWindow(400, 400);
+ end
+
+ function draw()
+   background(51);
+
+   circle(mouseX, mouseY, size);
+ end
+
+ -- Set larger circle size
+ function mousePressed()
+   size = 64;
+ end
+
+ -- Reset size
+ function mouseReleased()
+   size = 32;
+ end

\ No newline at end of file diff --git a/docs/latest/setting.html b/docs/latest/setting.html deleted file mode 100644 index 00c3f61d..00000000 --- a/docs/latest/setting.html +++ /dev/null @@ -1,3 +0,0 @@ -setting | lu5, a Lua Interpreter for Creative Coding

setting

v0.0.6
background(r, g, b, a);

Clear a background with a color

Arguments

rThe red byte
gThe green byte
bThe blue byte
aThe alpha byte


fill(r, g, b, [a]);

Set the fill color for shapes

Arguments

rThe red byte
gThe green byte
bThe blue byte
[a]The alpha byte

Can also accept a hexadecimal or color name as string

 fill(255, 150, 40);
- square(200, 200, 64);

strokeWeight(weight);

No description

Arguments

weightThe line width in pixels

 strokeWeight(8);
- line(200, 200, mouseX, mouseY);

noFill();

Disable fill


stroke(r, g, b, a);

Set the stroke color for shapes

Arguments

rThe red byte
gThe green byte
bThe blue byte
aThe alpha byte

Only implemented for line and circle


noStroke();

Disable stroke
Only implemented for line and circle


push();

Save the style settings


pop();

Restore the style settings


\ No newline at end of file diff --git a/docs/latest/setting/index.html b/docs/latest/setting/index.html new file mode 100644 index 00000000..f2c1d980 --- /dev/null +++ b/docs/latest/setting/index.html @@ -0,0 +1,3 @@ +lu5 | setting

setting

v0.0.6
background(r, g, b, a);

Clear a background with a color

Arguments

rThe red byte
gThe green byte
bThe blue byte
aThe alpha byte


fill(r, g, b, [a]);

Set the fill color for shapes

Arguments

rThe red byte
gThe green byte
bThe blue byte
[a]The alpha byte

Can also accept a hexadecimal or color name as string

 fill(255, 150, 40);
+ square(200, 200, 64);

strokeWeight(weight);

No description

Arguments

weightThe line width in pixels

 strokeWeight(8);
+ line(200, 200, mouseX, mouseY);

noFill();

Disable fill


stroke(r, g, b, a);

Set the stroke color for shapes

Arguments

rThe red byte
gThe green byte
bThe blue byte
aThe alpha byte

Only implemented for line and circle


noStroke();

Disable stroke
Only implemented for line and circle


push();

Save the style settings


pop();

Restore the style settings


\ No newline at end of file diff --git a/docs/latest/shapes.html b/docs/latest/shapes.html deleted file mode 100644 index d3250373..00000000 --- a/docs/latest/shapes.html +++ /dev/null @@ -1,7 +0,0 @@ -shapes | lu5, a Lua Interpreter for Creative Coding

shapes

v0.0.6
circle(x, y, d);

Draw a circle to the opengl context

Arguments

xThe x position of the circle
yThe y position of the circle
dThe diameter of the circle


rect(x, y, w, h);

Draw a rectangle to the opengl context

Arguments

xThe x position of the reactangle
yThe y position of the reactangle
wThe width
hThe height


square(x, y, s);

Draw a square to the opengl context

Arguments

xThe x position of the square
yThe y position of the square
sThe size of the square


line(x1, y1, x2, y2);

Draw a line to the opengl context

Arguments

x1The x position of the first point
y1The y position of the first point
x2The x position of the second point
y2The y position of the second point


quad(x1, y1, x2, y2, x3, y3, x4, y4);

Draw a quad on the screen

Arguments

x1The x position of the first point
y1The y position of the first point
x2The x position of the second point
y2The y position of the second point
x3The x position of the third point
y3The y position of the third point
x4The x position of the fourth point
y4The y position of the fourth point


point();

Draw a point on the screen


arc();

Draw an arc on the screen


ellipse();

Draw an ellipse on the screen


triangle();

Draw a triangle on the screen


beginShape(mode);

Begin adding vertices to a custom shape

Arguments

modeThe opengl shape mode LINES, POINTS, QUADS, TRIANGLES, TRIANGLE_FAN

The following would draw a 100 by 100 square at position 100, 100 -The following would draw a 100 by 100 square at position 100, 100

 beginShape(QUADS);
-   vertex(100, 100);
-   vertex(100, 200);
-   vertex(200, 200);
-   vertex(200, 100);
- endShape();

vertex(x, y);

beginShape must be called prior
Adding a vertex to a custom shape

Arguments

xThe x position
yThe y position


endShape();

beginShape must be called prior
Close the custom shape


\ No newline at end of file diff --git a/docs/latest/shapes/index.html b/docs/latest/shapes/index.html new file mode 100644 index 00000000..62011612 --- /dev/null +++ b/docs/latest/shapes/index.html @@ -0,0 +1,7 @@ +lu5 | shapes

shapes

v0.0.6
circle(x, y, d);

Draw a circle to the opengl context

Arguments

xThe x position of the circle
yThe y position of the circle
dThe diameter of the circle


rect(x, y, w, h);

Draw a rectangle to the opengl context

Arguments

xThe x position of the reactangle
yThe y position of the reactangle
wThe width
hThe height


square(x, y, s);

Draw a square to the opengl context

Arguments

xThe x position of the square
yThe y position of the square
sThe size of the square


line(x1, y1, x2, y2);

Draw a line to the opengl context

Arguments

x1The x position of the first point
y1The y position of the first point
x2The x position of the second point
y2The y position of the second point


quad(x1, y1, x2, y2, x3, y3, x4, y4);

Draw a quad on the screen

Arguments

x1The x position of the first point
y1The y position of the first point
x2The x position of the second point
y2The y position of the second point
x3The x position of the third point
y3The y position of the third point
x4The x position of the fourth point
y4The y position of the fourth point


point();

Draw a point on the screen


arc();

Draw an arc on the screen


ellipse();

Draw an ellipse on the screen


triangle();

Draw a triangle on the screen


beginShape(mode);

Begin adding vertices to a custom shape

Arguments

modeThe opengl shape mode LINES, POINTS, QUADS, TRIANGLES, TRIANGLE_FAN

The following would draw a 100 by 100 square at position 100, 100 +The following would draw a 100 by 100 square at position 100, 100

 beginShape(QUADS);
+   vertex(100, 100);
+   vertex(100, 200);
+   vertex(200, 200);
+   vertex(200, 100);
+ endShape();

vertex(x, y);

beginShape must be called prior
Adding a vertex to a custom shape

Arguments

xThe x position
yThe y position


endShape();

beginShape must be called prior
Close the custom shape


\ No newline at end of file diff --git a/docs/latest/typography.html b/docs/latest/typography.html deleted file mode 100644 index f762b467..00000000 --- a/docs/latest/typography.html +++ /dev/null @@ -1,13 +0,0 @@ -typography | lu5, a Lua Interpreter for Creative Coding

typography

v0.0.6
loadFont(path);

Load a font

Arguments

pathThe font path on the local system

Returns

fontThe image reference

 function setup()
-   createWindow(600, 600);
-   font = loadFont('/path/to/myfont.ttf');
- end
-
- function draw()
-   background(51);
-
-   textFont(font);
-   text('Hello from lu5!', 30, 50);
- end   

textSize(size);

Set the font size

Arguments

sizeThe size of the font in pixels

If this is called using fonts, make sure to call textSize after calling textFont

 textSize(56);
- text('Big Text', 50, 50);

textFont(font);

Set the font family

Arguments

fontThe font value returned when using loadFont

 textFont(myfont);
- text('Hello world!', 100, 200);

text(str, x, y);

Draw text on the screen

Arguments

strString to render
xThe x position of the start of the text
yThe y position of the top of the text

Fonts are not yet implemented

 text('Hello lu5!', 40, 60);

\ No newline at end of file diff --git a/docs/latest/typography/index.html b/docs/latest/typography/index.html new file mode 100644 index 00000000..7a9198ba --- /dev/null +++ b/docs/latest/typography/index.html @@ -0,0 +1,13 @@ +lu5 | typography

typography

v0.0.6
loadFont(path);

Load a font

Arguments

pathThe font path on the local system

Returns

fontThe image reference

 function setup()
+   createWindow(600, 600);
+   font = loadFont('/path/to/myfont.ttf');
+ end
+
+ function draw()
+   background(51);
+
+   textFont(font);
+   text('Hello from lu5!', 30, 50);
+ end   

textSize(size);

Set the font size

Arguments

sizeThe size of the font in pixels

If this is called using fonts, make sure to call textSize after calling textFont

 textSize(56);
+ text('Big Text', 50, 50);

textFont(font);

Set the font family

Arguments

fontThe font value returned when using loadFont

 textFont(myfont);
+ text('Hello world!', 100, 200);

text(str, x, y);

Draw text on the screen

Arguments

strString to render
xThe x position of the start of the text
yThe y position of the top of the text

Fonts are not yet implemented

 text('Hello lu5!', 40, 60);

\ No newline at end of file diff --git a/docs/latest/vector.html b/docs/latest/vector.html deleted file mode 100644 index 60de3741..00000000 --- a/docs/latest/vector.html +++ /dev/null @@ -1,23 +0,0 @@ -vector | lu5, a Lua Interpreter for Creative Coding

vector

v0.0.6
createVector(x, y);

Create a vector instance

Arguments

xThe first component of the vector
yThe second component of the vector

Returns

VectorThe created vector

 local a = createVector(3, 5);
- local b = createVector(1, 3);
- 
- local c = a:add(b);
- 
- print(c);

Vector.print();

Since a Vector implements a print method, it can be used in the print function

 local a = createVector(3, 5);
- 
- -- With print
- print(a);
-
- -- With class method
- Vector.print(a);
-
- -- with instance
- a:print();

Vector.mult(a, b);

No description

Arguments

aThe first vector
bThe second vector

Returns

VectorThe added vector

 local a = createVector(3, 5);
- local b = createVector(1, 3);
- 
- print(a:mult(b));
- print(Vector.mult(a, b));

Vector.add(a, b);

No description

Arguments

aThe first vector
bThe second vector

Returns

VectorThe multiplied vector

 local a = createVector(1, 4);
- local b = createVector(8, 2);
- 
- print(a:add(b));
- print(Vector.add(a, b));

\ No newline at end of file diff --git a/docs/latest/vector/index.html b/docs/latest/vector/index.html new file mode 100644 index 00000000..bd011902 --- /dev/null +++ b/docs/latest/vector/index.html @@ -0,0 +1,23 @@ +lu5 | vector

vector

v0.0.6
createVector(x, y);

Create a vector instance

Arguments

xThe first component of the vector
yThe second component of the vector

Returns

VectorThe created vector

 local a = createVector(3, 5);
+ local b = createVector(1, 3);
+ 
+ local c = a:add(b);
+ 
+ print(c);

Vector.print();

Since a Vector implements a print method, it can be used in the print function

 local a = createVector(3, 5);
+ 
+ -- With print
+ print(a);
+
+ -- With class method
+ Vector.print(a);
+
+ -- with instance
+ a:print();

Vector.mult(a, b);

No description

Arguments

aThe first vector
bThe second vector

Returns

VectorThe added vector

 local a = createVector(3, 5);
+ local b = createVector(1, 3);
+ 
+ print(a:mult(b));
+ print(Vector.mult(a, b));

Vector.add(a, b);

No description

Arguments

aThe first vector
bThe second vector

Returns

VectorThe multiplied vector

 local a = createVector(1, 4);
+ local b = createVector(8, 2);
+ 
+ print(a:add(b));
+ print(Vector.add(a, b));

\ No newline at end of file diff --git a/docs/latest/window.html b/docs/latest/window.html deleted file mode 100644 index 7f1035aa..00000000 --- a/docs/latest/window.html +++ /dev/null @@ -1,52 +0,0 @@ -window | lu5, a Lua Interpreter for Creative Coding

window

v0.0.6
createWindow(w, h);

Create a GLFW window.

Arguments

wWindow width
hWindow height

It is also possible to create a window in the global scope without defining a setup function.

 function setup()
-   -- Create the window here
-   createWindow(600, 600);
- end
-
- function draw()
-   -- draw things
- end

frameRate(fps);

Set the frame rate

Arguments

fpsThe frame rate to set

If frame rate is called without an argument, it will return frame per seconds

 x = 0;
-
- function setup()
-   createWindow(400, 400);
-   frameRate(24);
- end
-
- function draw()
-   background(51);
-   text('fps: ' .. frameRate(), 20, 10);
-
-   circle(x, 200, 32);
-   x = x + 1;
- end

deltaTimeGlobal

Elapsed 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(51);
-
-   circle(x, height/2, 32);
-
-   -- Get the same velocity with different framerates
-   x = x + vx deltaTime;
- end

widthGlobal

The window's width in pixels. If no window was created, this value is nil

 createWindow(800, 600);
-
- print(width);
- -- 800

heightGlobal

The window's height in pixels. If no window was created, this value is nil

 createWindow(800, 600);
-
- print(height);
- -- 600

windowResized();Event

Called when the window is resized

 function setup()
-     createWindow(500, 500);
- end
- 
- function draw()
-     background(51)
- end
- 
- function windowResized()
-     print('Resized!')
- end

\ No newline at end of file diff --git a/docs/latest/window/index.html b/docs/latest/window/index.html new file mode 100644 index 00000000..54ef54cf --- /dev/null +++ b/docs/latest/window/index.html @@ -0,0 +1,52 @@ +lu5 | window

window

v0.0.6
createWindow(w, h);

Create a GLFW window.

Arguments

wWindow width
hWindow height

It is also possible to create a window in the global scope without defining a setup function.

 function setup()
+   -- Create the window here
+   createWindow(600, 600);
+ end
+
+ function draw()
+   -- draw things
+ end

frameRate(fps);

Set the frame rate

Arguments

fpsThe frame rate to set

If frame rate is called without an argument, it will return frame per seconds

 x = 0;
+
+ function setup()
+   createWindow(400, 400);
+   frameRate(24);
+ end
+
+ function draw()
+   background(51);
+   text('fps: ' .. frameRate(), 20, 10);
+
+   circle(x, 200, 32);
+   x = x + 1;
+ end

deltaTimeGlobal

Elapsed 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(51);
+
+   circle(x, height/2, 32);
+
+   -- Get the same velocity with different framerates
+   x = x + vx deltaTime;
+ end

widthGlobal

The window's width in pixels. If no window was created, this value is nil

 createWindow(800, 600);
+
+ print(width);
+ -- 800

heightGlobal

The window's height in pixels. If no window was created, this value is nil

 createWindow(800, 600);
+
+ print(height);
+ -- 600

windowResized();Event

Called when the window is resized

 function setup()
+     createWindow(500, 500);
+ end
+ 
+ function draw()
+     background(51)
+ end
+ 
+ function windowResized()
+     print('Resized!')
+ end

\ No newline at end of file diff --git a/docs/v0.0.6/classes.html b/docs/v0.0.6/classes.html deleted file mode 100644 index a8201937..00000000 --- a/docs/v0.0.6/classes.html +++ /dev/null @@ -1,27 +0,0 @@ -classes | lu5, a Lua Interpreter for Creative Coding

classes

v0.0.6
class(name);

Create a class.
if a class implements a print method, it can be used in the print function

Arguments

nameThe class name

 local Player = class('Player');
-
- function Player:init(x, y)
-   self.x = x;
-   self.y = y;
-   return self;
- end
-
- function Player:draw()
-   circle(self.x, self.y, 16);
- end
-
-
- -- Create 2 players and draw them
- local p1 = Player:new(100, 200);
- local p2 = Player:new(300, 200);
-
- function setup()
-   createWindow(400, 400);
- end
- 
- function draw()
-   background(51);
-
-   p1:draw();
-   p2:draw();
- end

\ No newline at end of file diff --git a/docs/v0.0.6/classes/index.html b/docs/v0.0.6/classes/index.html new file mode 100644 index 00000000..40d714c5 --- /dev/null +++ b/docs/v0.0.6/classes/index.html @@ -0,0 +1,27 @@ +lu5 | classes

classes

v0.0.6
class(name);

Create a class.
if a class implements a print method, it can be used in the print function

Arguments

nameThe class name

 local Player = class('Player');
+
+ function Player:init(x, y)
+   self.x = x;
+   self.y = y;
+   return self;
+ end
+
+ function Player:draw()
+   circle(self.x, self.y, 16);
+ end
+
+
+ -- Create 2 players and draw them
+ local p1 = Player:new(100, 200);
+ local p2 = Player:new(300, 200);
+
+ function setup()
+   createWindow(400, 400);
+ end
+ 
+ function draw()
+   background(51);
+
+   p1:draw();
+   p2:draw();
+ end

\ No newline at end of file diff --git a/docs/v0.0.6/image.html b/docs/v0.0.6/image.html deleted file mode 100644 index 3c7a8112..00000000 --- a/docs/v0.0.6/image.html +++ /dev/null @@ -1,10 +0,0 @@ -image | lu5, a Lua Interpreter for Creative Coding

image

v0.0.6
loadImage(path);

Load a png or jpeg image

Arguments

pathThe local image path

Returns

imgThe image reference

 function setup()
-   createWindow(600, 600);
-   img = loadImage('/path/to/mypic.png');
- end
-
- function draw()
-   background(51);
-
-   image(img, 0, 0);
- end   

image(image, x, y, [w], [h]);

Draw an image to the screen

Arguments

imageThe image reference
xThe x position of the image
yThe y position of the image
[w]The width of the image, if not specified, using source width
[h]The height of the image, if not specified, using source height


\ No newline at end of file diff --git a/docs/v0.0.6/image/index.html b/docs/v0.0.6/image/index.html new file mode 100644 index 00000000..b952ac2a --- /dev/null +++ b/docs/v0.0.6/image/index.html @@ -0,0 +1,10 @@ +lu5 | image

image

v0.0.6
loadImage(path);

Load a png or jpeg image

Arguments

pathThe local image path

Returns

imgThe image reference

 function setup()
+   createWindow(600, 600);
+   img = loadImage('/path/to/mypic.png');
+ end
+
+ function draw()
+   background(51);
+
+   image(img, 0, 0);
+ end   

image(image, x, y, [w], [h]);

Draw an image to the screen

Arguments

imageThe image reference
xThe x position of the image
yThe y position of the image
[w]The width of the image, if not specified, using source width
[h]The height of the image, if not specified, using source height


\ No newline at end of file diff --git a/docs/v0.0.6/index.html b/docs/v0.0.6/index.html index 98e41ce3..7f27fdbb 100644 --- a/docs/v0.0.6/index.html +++ b/docs/v0.0.6/index.html @@ -1 +1 @@ -Reference | lu5, a Lua Interpreter for Creative Coding

Reference

v0.0.6

classes

\ No newline at end of file +lu5 | Reference

Reference

v0.0.6

classes

\ No newline at end of file diff --git a/docs/v0.0.6/io.html b/docs/v0.0.6/io.html deleted file mode 100644 index ef72ef64..00000000 --- a/docs/v0.0.6/io.html +++ /dev/null @@ -1,9 +0,0 @@ -io | lu5, a Lua Interpreter for Creative Coding

io

v0.0.6
print(value);

Printing utility, can take any lua type.

Arguments

valueThe value to print to stdout

 print(42);
-
- print(1, 2, 3);
- 
- print('Hello world');
-
- print({ 3, 8, 1 });

loadText(file_path);

Read a file as a string

Arguments

file_pathThe path of the file

 file = loadText("./your-file.txt");
- print(file)

loadStrings(file_path);

Read a file as an array of strings split by line

Arguments

file_pathThe path of the file

 file = loadStrings("./your-file.txt");
- print(file)

\ No newline at end of file diff --git a/docs/v0.0.6/io/index.html b/docs/v0.0.6/io/index.html new file mode 100644 index 00000000..c8a5fedb --- /dev/null +++ b/docs/v0.0.6/io/index.html @@ -0,0 +1,9 @@ +lu5 | io

io

v0.0.6
print(value);

Printing utility, can take any lua type.

Arguments

valueThe value to print to stdout

 print(42);
+
+ print(1, 2, 3);
+ 
+ print('Hello world');
+
+ print({ 3, 8, 1 });

loadText(file_path);

Read a file as a string

Arguments

file_pathThe path of the file

 file = loadText("./your-file.txt");
+ print(file)

loadStrings(file_path);

Read a file as an array of strings split by line

Arguments

file_pathThe path of the file

 file = loadStrings("./your-file.txt");
+ print(file)

\ No newline at end of file diff --git a/docs/v0.0.6/keyboard.html b/docs/v0.0.6/keyboard.html deleted file mode 100644 index b0997ac5..00000000 --- a/docs/v0.0.6/keyboard.html +++ /dev/null @@ -1,19 +0,0 @@ -keyboard | lu5, a Lua Interpreter for Creative Coding

keyboard

v0.0.6
keyIsDown(k);

Check if a keyboard key is pressed, returns true if key is down and returns false if it's not

Arguments

kThe keyboard key to check as a key global, or a string

Returns

booleanWhether or not the key is down

 -- Use a string 
- if (keyIsDown('a')) then
-   -- key 'a' is down
- end
-
- -- use a global
- if (keyIsDown(LEFT_ARROW)) then
-   -- left arrow is down
- end

keyPressed(key, keyCode);Event

Called whenever a key is pressed.

Arguments

keyThe pressed key as a string, is nil if glfw cannot find a name for the key
keyCodeThe pressed key as a key code

 function setup()
-    createWindow(600, 600);
- end
- 
- function draw()
-    background(51);
- end
- 
- function keyPressed(key, keyCode)
-    print(key, keyCode)
- end

keyReleased(key, keyCode);Event

Called whenever a key is released.

Arguments

keyThe released key as a string, is nil if glfw cannot find a name for the key
keyCodeThe released key as a key code


keyHeld(key, keyCode);Event

Called whenever a key is held down.

Arguments

keyThe held key as a string, is nil if glfw cannot find a name for the key
keyCodeThe held key as a key code


UP_ARROWGlobal

No description


DOWN_ARROWGlobal

No description


LEFT_ARROWGlobal

No description


RIGHT_ARROWGlobal

No description


KEY_ENTERGlobal

No description


KEY_BACKSPACEGlobal

No description


KEY_AGlobal

No description


KEY_BGlobal

No description


KEY_CGlobal

No description


KEY_DGlobal

No description


KEY_EGlobal

No description


KEY_FGlobal

No description


KEY_GGlobal

No description


KEY_HGlobal

No description


KEY_IGlobal

No description


KEY_JGlobal

No description


KEY_KGlobal

No description


KEY_LGlobal

No description


KEY_MGlobal

No description


KEY_NGlobal

No description


KEY_OGlobal

No description


KEY_PGlobal

No description


KEY_QGlobal

No description


KEY_RGlobal

No description


KEY_SGlobal

No description


KEY_TGlobal

No description


KEY_UGlobal

No description


KEY_VGlobal

No description


KEY_WGlobal

No description


KEY_XGlobal

No description


KEY_YGlobal

No description


KEY_ZGlobal

No description


\ No newline at end of file diff --git a/docs/v0.0.6/keyboard/index.html b/docs/v0.0.6/keyboard/index.html new file mode 100644 index 00000000..be6de1b9 --- /dev/null +++ b/docs/v0.0.6/keyboard/index.html @@ -0,0 +1,19 @@ +lu5 | keyboard

keyboard

v0.0.6
keyIsDown(k);

Check if a keyboard key is pressed, returns true if key is down and returns false if it's not

Arguments

kThe keyboard key to check as a key global, or a string

Returns

booleanWhether or not the key is down

 -- Use a string 
+ if (keyIsDown('a')) then
+   -- key 'a' is down
+ end
+
+ -- use a global
+ if (keyIsDown(LEFT_ARROW)) then
+   -- left arrow is down
+ end

keyPressed(key, keyCode);Event

Called whenever a key is pressed.

Arguments

keyThe pressed key as a string, is nil if glfw cannot find a name for the key
keyCodeThe pressed key as a key code

 function setup()
+    createWindow(600, 600);
+ end
+ 
+ function draw()
+    background(51);
+ end
+ 
+ function keyPressed(key, keyCode)
+    print(key, keyCode)
+ end

keyReleased(key, keyCode);Event

Called whenever a key is released.

Arguments

keyThe released key as a string, is nil if glfw cannot find a name for the key
keyCodeThe released key as a key code


keyHeld(key, keyCode);Event

Called whenever a key is held down.

Arguments

keyThe held key as a string, is nil if glfw cannot find a name for the key
keyCodeThe held key as a key code


UP_ARROWGlobal

No description


DOWN_ARROWGlobal

No description


LEFT_ARROWGlobal

No description


RIGHT_ARROWGlobal

No description


KEY_ENTERGlobal

No description


KEY_BACKSPACEGlobal

No description


KEY_AGlobal

No description


KEY_BGlobal

No description


KEY_CGlobal

No description


KEY_DGlobal

No description


KEY_EGlobal

No description


KEY_FGlobal

No description


KEY_GGlobal

No description


KEY_HGlobal

No description


KEY_IGlobal

No description


KEY_JGlobal

No description


KEY_KGlobal

No description


KEY_LGlobal

No description


KEY_MGlobal

No description


KEY_NGlobal

No description


KEY_OGlobal

No description


KEY_PGlobal

No description


KEY_QGlobal

No description


KEY_RGlobal

No description


KEY_SGlobal

No description


KEY_TGlobal

No description


KEY_UGlobal

No description


KEY_VGlobal

No description


KEY_WGlobal

No description


KEY_XGlobal

No description


KEY_YGlobal

No description


KEY_ZGlobal

No description


\ No newline at end of file diff --git a/docs/v0.0.6/math.html b/docs/v0.0.6/math.html deleted file mode 100644 index 620c5c52..00000000 --- a/docs/v0.0.6/math.html +++ /dev/null @@ -1,13 +0,0 @@ -math | lu5, a Lua Interpreter for Creative Coding

math

v0.0.6
randomSeed(seed);

Set a random seed

Arguments

seedThe seed value

Returns

numberThe random value


random(min, max);

Get a random number

Arguments

minThe minimum of the range
maxThe maximum of the range

Returns

numberThe random value

 random()      -- random number between 0 and 1
- random(3)     -- random number between 0 and 3
- random(3, 12) -- random number between 3 and 12
-
- random({ 'A', 'B', 'C' }) -- random element in table

round(x);

Round a number to the nearest integer

Arguments

xThe value to round

Returns

intThe rounded value


floor(x);

floor is a function that takes in a number, and returns the greatest integer less or equal to x
see here

Arguments

xThe value to floor

Returns

intgreatest integer less than or equals to x


ceil(x);

ceil is a function that takes in a number, and returns the smallest integer greater or equal to x
see here

Arguments

xThe value to floor

Returns

intThe floored value


min(a, b);

Return the smallest value.
Can also take any number of arguments, or a table.

Arguments

aThe first value
bThe second value

Returns

numberThe smallest value

 min(6, 7); -- returns 6
-
- min(6, 7, 4); -- returns 4
-
- min({ 6, 7, 4 }); -- returns 4

max(a, b);

Return the largest value.
Can also take any number of arguments, or a table.

Arguments

aThe first value
bThe second value

Returns

numberThe largest value

 max(2, 5); -- returns 5
-
- max(2, 5, 7); -- returns 7
-
- max({ 2, 5, 7 }); -- returns 7

abs(x);

Returns the absolute value of x which is its distance from 0
see here

Arguments

xThe input value

Returns

numberThe absolote value of the input


map(x, s1, e1, s2, e2);

Maps x from an original range to a target range

Arguments

xThe value to map
s1The start of the initial range
e1The end of the initial range
s2The start of the target range
e2The end of the target range

Returns

numberThe mapped value


dist(x1, y1, x2, y1);

Calculates the distance between 2 points in 2D space

Arguments

x1The x coordinate of the first point
y1The y coordinate of the first point
x2The x coordinate of the second point
y1The y coordinate of the second point

Returns

numberThe distance between the points


constrain(x, min, max);

Limits x to a minimum and maximum value

Arguments

xThe input value
minThe minimum value
maxThe maximum value

Returns

numberThe constrained value


sin(x);

Sine function (Trigonometry)

Arguments

xThe input value

Returns

numberThe output value


cos(x);

Cosine function (Trigonometry)

Arguments

xThe input value

Returns

numberThe output value


tan(x);

Tangent function (Trigonometry)

Arguments

xThe input value

Returns

numberThe output value


PIGlobal

No description


TWO_PIGlobal

No description


HALF_PIGlobal

No description


QUARTER_PIGlobal

No description


\ No newline at end of file diff --git a/docs/v0.0.7/math.html b/docs/v0.0.6/math/index.html similarity index 52% rename from docs/v0.0.7/math.html rename to docs/v0.0.6/math/index.html index 5f82c6a3..c37ff802 100644 --- a/docs/v0.0.7/math.html +++ b/docs/v0.0.6/math/index.html @@ -1,13 +1,13 @@ -math | lu5, a Lua Interpreter for Creative Coding

math

v0.0.7
randomSeed(seed);

Set a random seed

Arguments

seedThe seed value

Returns

numberThe random value


random(min, max);

Get a random number

Arguments

minThe minimum of the range
maxThe maximum of the range

Returns

numberThe random value

 random()      -- random number between 0 and 1
+lu5 | math

math

v0.0.6
randomSeed(seed);

Set a random seed

Arguments

seedThe seed value

Returns

numberThe random value


random(min, max);

Get a random number

Arguments

minThe minimum of the range
maxThe maximum of the range

Returns

numberThe random value

 random()      -- random number between 0 and 1
  random(3)     -- random number between 0 and 3
  random(3, 12) -- random number between 3 and 12
 
- random({ 'A', 'B', 'C' }) -- random element in table

round(x);

Round a number to the nearest integer

Arguments

xThe value to round

Returns

intThe rounded value


floor(x);

floor is a function that takes in a number, and returns the greatest integer less or equal to x
see here

Arguments

xThe value to floor

Returns

intgreatest integer less than or equals to x


ceil(x);

ceil is a function that takes in a number, and returns the smallest integer greater or equal to x
see here

Arguments

xThe value to floor

Returns

intThe floored value


min(a, b);

Return the smallest value.
Can also take any number of arguments, or a table.

Arguments

aThe first value
bThe second value

Returns

numberThe smallest value

 min(6, 7); -- returns 6
+ random({ 'A', 'B', 'C' }) -- random element in table

round(x);

Round a number to the nearest integer

Arguments

xThe value to round

Returns

intThe rounded value


floor(x);

floor is a function that takes in a number, and returns the greatest integer less or equal to x
see here

Arguments

xThe value to floor

Returns

intgreatest integer less than or equals to x


ceil(x);

ceil is a function that takes in a number, and returns the smallest integer greater or equal to x
see here

Arguments

xThe value to floor

Returns

intThe floored value


min(a, b);

Return the smallest value.
Can also take any number of arguments, or a table.

Arguments

aThe first value
bThe second value

Returns

numberThe smallest value

 min(6, 7); -- returns 6
 
  min(6, 7, 4); -- returns 4
 
- min({ 6, 7, 4 }); -- returns 4

max(a, b);

Return the largest value.
Can also take any number of arguments, or a table.

Arguments

aThe first value
bThe second value

Returns

numberThe largest value

 max(2, 5); -- returns 5
+ min({ 6, 7, 4 }); -- returns 4

max(a, b);

Return the largest value.
Can also take any number of arguments, or a table.

Arguments

aThe first value
bThe second value

Returns

numberThe largest value

 max(2, 5); -- returns 5
 
  max(2, 5, 7); -- returns 7
 
- max({ 2, 5, 7 }); -- returns 7

abs(x);

Returns the absolute value of x which is its distance from 0
see here

Arguments

xThe input value

Returns

numberThe absolote value of the input


map(x, s1, e1, s2, e2);

Maps x from an original range to a target range

Arguments

xThe value to map
s1The start of the initial range
e1The end of the initial range
s2The start of the target range
e2The end of the target range

Returns

numberThe mapped value


dist(x1, y1, x2, y1);

Calculates the distance between 2 points in 2D space

Arguments

x1The x coordinate of the first point
y1The y coordinate of the first point
x2The x coordinate of the second point
y1The y coordinate of the second point

Returns

numberThe distance between the points


constrain(x, min, max);

Limits x to a minimum and maximum value

Arguments

xThe input value
minThe minimum value
maxThe maximum value

Returns

numberThe constrained value


sin(x);

Sine function (Trigonometry)

Arguments

xThe input value

Returns

numberThe output value


cos(x);

Cosine function (Trigonometry)

Arguments

xThe input value

Returns

numberThe output value


tan(x);

Tangent function (Trigonometry)

Arguments

xThe input value

Returns

numberThe output value


PIGlobal

No description


TWO_PIGlobal

No description


HALF_PIGlobal

No description


QUARTER_PIGlobal

No description


\ No newline at end of file + max({ 2, 5, 7 }); -- returns 7

abs(x);

Returns the absolute value of x which is its distance from 0
see here

Arguments

xThe input value

Returns

numberThe absolote value of the input


map(x, s1, e1, s2, e2);

Maps x from an original range to a target range

Arguments

xThe value to map
s1The start of the initial range
e1The end of the initial range
s2The start of the target range
e2The end of the target range

Returns

numberThe mapped value


dist(x1, y1, x2, y1);

Calculates the distance between 2 points in 2D space

Arguments

x1The x coordinate of the first point
y1The y coordinate of the first point
x2The x coordinate of the second point
y1The y coordinate of the second point

Returns

numberThe distance between the points


constrain(x, min, max);

Limits x to a minimum and maximum value

Arguments

xThe input value
minThe minimum value
maxThe maximum value

Returns

numberThe constrained value


sin(x);

Sine function (Trigonometry)

Arguments

xThe input value

Returns

numberThe output value


cos(x);

Cosine function (Trigonometry)

Arguments

xThe input value

Returns

numberThe output value


tan(x);

Tangent function (Trigonometry)

Arguments

xThe input value

Returns

numberThe output value


PIGlobal

No description


TWO_PIGlobal

No description


HALF_PIGlobal

No description


QUARTER_PIGlobal

No description


\ No newline at end of file diff --git a/docs/v0.0.6/mouse.html b/docs/v0.0.6/mouse.html deleted file mode 100644 index ea296121..00000000 --- a/docs/v0.0.6/mouse.html +++ /dev/null @@ -1,50 +0,0 @@ -mouse | lu5, a Lua Interpreter for Creative Coding

mouse

v0.0.6
mouseXGlobal

The x mouse coordinate

 createWindow(400, 400);
-
- function draw()
-   background(51);
-   
-   line(mouseX, 0, mouseX, height);
- end

mouseYGlobal

The y mouse coordinate

 createWindow(400, 400);
-
- function draw()
-   background(51);
-   
-   line(0, mouseY, width, mouseY);
- end

mouseIsPressedGlobal

Is true when the mouse is pressed, is false when it's not


mousePressed(button);Event

Called when a mouse button is pressed.

Arguments

buttonThe pressed mouse button


-In the following example, the circle's size increases when the user clicks the mouse.

 size = 0;
-
- function setup()
-   createWindow(400, 400);
- end
-
- function draw()
-   background(51);
-
-   circle(mouseX, mouseY, size);
- end
-
- -- Increase circle size when mouse pressed
- function mousePressed()
-   size = size + 1;
- end

mouseReleased(button);Event

Called when a mouse button is released.

Arguments

buttonThe released mouse button


-In the following example, the circle's size increases when the user clicks the mouse.

 size = 32;
-
- function setup()
-   createWindow(400, 400);
- end
-
- function draw()
-   background(51);
-
-   circle(mouseX, mouseY, size);
- end
-
- -- Set larger circle size
- function mousePressed()
-   size = 64;
- end
-
- -- Reset size
- function mouseReleased()
-   size = 32;
- end

\ No newline at end of file diff --git a/docs/v0.0.6/mouse/index.html b/docs/v0.0.6/mouse/index.html new file mode 100644 index 00000000..bb3d7f81 --- /dev/null +++ b/docs/v0.0.6/mouse/index.html @@ -0,0 +1,50 @@ +lu5 | mouse

mouse

v0.0.6
mouseXGlobal

The x mouse coordinate

 createWindow(400, 400);
+
+ function draw()
+   background(51);
+   
+   line(mouseX, 0, mouseX, height);
+ end

mouseYGlobal

The y mouse coordinate

 createWindow(400, 400);
+
+ function draw()
+   background(51);
+   
+   line(0, mouseY, width, mouseY);
+ end

mouseIsPressedGlobal

Is true when the mouse is pressed, is false when it's not


mousePressed(button);Event

Called when a mouse button is pressed.

Arguments

buttonThe pressed mouse button


+In the following example, the circle's size increases when the user clicks the mouse.

 size = 0;
+
+ function setup()
+   createWindow(400, 400);
+ end
+
+ function draw()
+   background(51);
+
+   circle(mouseX, mouseY, size);
+ end
+
+ -- Increase circle size when mouse pressed
+ function mousePressed()
+   size = size + 1;
+ end

mouseReleased(button);Event

Called when a mouse button is released.

Arguments

buttonThe released mouse button


+In the following example, the circle's size increases when the user clicks the mouse.

 size = 32;
+
+ function setup()
+   createWindow(400, 400);
+ end
+
+ function draw()
+   background(51);
+
+   circle(mouseX, mouseY, size);
+ end
+
+ -- Set larger circle size
+ function mousePressed()
+   size = 64;
+ end
+
+ -- Reset size
+ function mouseReleased()
+   size = 32;
+ end

\ No newline at end of file diff --git a/docs/v0.0.6/setting.html b/docs/v0.0.6/setting.html deleted file mode 100644 index 00c3f61d..00000000 --- a/docs/v0.0.6/setting.html +++ /dev/null @@ -1,3 +0,0 @@ -setting | lu5, a Lua Interpreter for Creative Coding

setting

v0.0.6
background(r, g, b, a);

Clear a background with a color

Arguments

rThe red byte
gThe green byte
bThe blue byte
aThe alpha byte


fill(r, g, b, [a]);

Set the fill color for shapes

Arguments

rThe red byte
gThe green byte
bThe blue byte
[a]The alpha byte

Can also accept a hexadecimal or color name as string

 fill(255, 150, 40);
- square(200, 200, 64);

strokeWeight(weight);

No description

Arguments

weightThe line width in pixels

 strokeWeight(8);
- line(200, 200, mouseX, mouseY);

noFill();

Disable fill


stroke(r, g, b, a);

Set the stroke color for shapes

Arguments

rThe red byte
gThe green byte
bThe blue byte
aThe alpha byte

Only implemented for line and circle


noStroke();

Disable stroke
Only implemented for line and circle


push();

Save the style settings


pop();

Restore the style settings


\ No newline at end of file diff --git a/docs/v0.0.6/setting/index.html b/docs/v0.0.6/setting/index.html new file mode 100644 index 00000000..f2c1d980 --- /dev/null +++ b/docs/v0.0.6/setting/index.html @@ -0,0 +1,3 @@ +lu5 | setting

setting

v0.0.6
background(r, g, b, a);

Clear a background with a color

Arguments

rThe red byte
gThe green byte
bThe blue byte
aThe alpha byte


fill(r, g, b, [a]);

Set the fill color for shapes

Arguments

rThe red byte
gThe green byte
bThe blue byte
[a]The alpha byte

Can also accept a hexadecimal or color name as string

 fill(255, 150, 40);
+ square(200, 200, 64);

strokeWeight(weight);

No description

Arguments

weightThe line width in pixels

 strokeWeight(8);
+ line(200, 200, mouseX, mouseY);

noFill();

Disable fill


stroke(r, g, b, a);

Set the stroke color for shapes

Arguments

rThe red byte
gThe green byte
bThe blue byte
aThe alpha byte

Only implemented for line and circle


noStroke();

Disable stroke
Only implemented for line and circle


push();

Save the style settings


pop();

Restore the style settings


\ No newline at end of file diff --git a/docs/v0.0.6/shapes.html b/docs/v0.0.6/shapes.html deleted file mode 100644 index d3250373..00000000 --- a/docs/v0.0.6/shapes.html +++ /dev/null @@ -1,7 +0,0 @@ -shapes | lu5, a Lua Interpreter for Creative Coding

shapes

v0.0.6
circle(x, y, d);

Draw a circle to the opengl context

Arguments

xThe x position of the circle
yThe y position of the circle
dThe diameter of the circle


rect(x, y, w, h);

Draw a rectangle to the opengl context

Arguments

xThe x position of the reactangle
yThe y position of the reactangle
wThe width
hThe height


square(x, y, s);

Draw a square to the opengl context

Arguments

xThe x position of the square
yThe y position of the square
sThe size of the square


line(x1, y1, x2, y2);

Draw a line to the opengl context

Arguments

x1The x position of the first point
y1The y position of the first point
x2The x position of the second point
y2The y position of the second point


quad(x1, y1, x2, y2, x3, y3, x4, y4);

Draw a quad on the screen

Arguments

x1The x position of the first point
y1The y position of the first point
x2The x position of the second point
y2The y position of the second point
x3The x position of the third point
y3The y position of the third point
x4The x position of the fourth point
y4The y position of the fourth point


point();

Draw a point on the screen


arc();

Draw an arc on the screen


ellipse();

Draw an ellipse on the screen


triangle();

Draw a triangle on the screen


beginShape(mode);

Begin adding vertices to a custom shape

Arguments

modeThe opengl shape mode LINES, POINTS, QUADS, TRIANGLES, TRIANGLE_FAN

The following would draw a 100 by 100 square at position 100, 100 -The following would draw a 100 by 100 square at position 100, 100

 beginShape(QUADS);
-   vertex(100, 100);
-   vertex(100, 200);
-   vertex(200, 200);
-   vertex(200, 100);
- endShape();

vertex(x, y);

beginShape must be called prior
Adding a vertex to a custom shape

Arguments

xThe x position
yThe y position


endShape();

beginShape must be called prior
Close the custom shape


\ No newline at end of file diff --git a/docs/v0.0.6/shapes/index.html b/docs/v0.0.6/shapes/index.html new file mode 100644 index 00000000..62011612 --- /dev/null +++ b/docs/v0.0.6/shapes/index.html @@ -0,0 +1,7 @@ +lu5 | shapes

shapes

v0.0.6
circle(x, y, d);

Draw a circle to the opengl context

Arguments

xThe x position of the circle
yThe y position of the circle
dThe diameter of the circle


rect(x, y, w, h);

Draw a rectangle to the opengl context

Arguments

xThe x position of the reactangle
yThe y position of the reactangle
wThe width
hThe height


square(x, y, s);

Draw a square to the opengl context

Arguments

xThe x position of the square
yThe y position of the square
sThe size of the square


line(x1, y1, x2, y2);

Draw a line to the opengl context

Arguments

x1The x position of the first point
y1The y position of the first point
x2The x position of the second point
y2The y position of the second point


quad(x1, y1, x2, y2, x3, y3, x4, y4);

Draw a quad on the screen

Arguments

x1The x position of the first point
y1The y position of the first point
x2The x position of the second point
y2The y position of the second point
x3The x position of the third point
y3The y position of the third point
x4The x position of the fourth point
y4The y position of the fourth point


point();

Draw a point on the screen


arc();

Draw an arc on the screen


ellipse();

Draw an ellipse on the screen


triangle();

Draw a triangle on the screen


beginShape(mode);

Begin adding vertices to a custom shape

Arguments

modeThe opengl shape mode LINES, POINTS, QUADS, TRIANGLES, TRIANGLE_FAN

The following would draw a 100 by 100 square at position 100, 100 +The following would draw a 100 by 100 square at position 100, 100

 beginShape(QUADS);
+   vertex(100, 100);
+   vertex(100, 200);
+   vertex(200, 200);
+   vertex(200, 100);
+ endShape();

vertex(x, y);

beginShape must be called prior
Adding a vertex to a custom shape

Arguments

xThe x position
yThe y position


endShape();

beginShape must be called prior
Close the custom shape


\ No newline at end of file diff --git a/docs/v0.0.6/typography.html b/docs/v0.0.6/typography.html deleted file mode 100644 index f762b467..00000000 --- a/docs/v0.0.6/typography.html +++ /dev/null @@ -1,13 +0,0 @@ -typography | lu5, a Lua Interpreter for Creative Coding

typography

v0.0.6
loadFont(path);

Load a font

Arguments

pathThe font path on the local system

Returns

fontThe image reference

 function setup()
-   createWindow(600, 600);
-   font = loadFont('/path/to/myfont.ttf');
- end
-
- function draw()
-   background(51);
-
-   textFont(font);
-   text('Hello from lu5!', 30, 50);
- end   

textSize(size);

Set the font size

Arguments

sizeThe size of the font in pixels

If this is called using fonts, make sure to call textSize after calling textFont

 textSize(56);
- text('Big Text', 50, 50);

textFont(font);

Set the font family

Arguments

fontThe font value returned when using loadFont

 textFont(myfont);
- text('Hello world!', 100, 200);

text(str, x, y);

Draw text on the screen

Arguments

strString to render
xThe x position of the start of the text
yThe y position of the top of the text

Fonts are not yet implemented

 text('Hello lu5!', 40, 60);

\ No newline at end of file diff --git a/docs/v0.0.6/typography/index.html b/docs/v0.0.6/typography/index.html new file mode 100644 index 00000000..7a9198ba --- /dev/null +++ b/docs/v0.0.6/typography/index.html @@ -0,0 +1,13 @@ +lu5 | typography

typography

v0.0.6
loadFont(path);

Load a font

Arguments

pathThe font path on the local system

Returns

fontThe image reference

 function setup()
+   createWindow(600, 600);
+   font = loadFont('/path/to/myfont.ttf');
+ end
+
+ function draw()
+   background(51);
+
+   textFont(font);
+   text('Hello from lu5!', 30, 50);
+ end   

textSize(size);

Set the font size

Arguments

sizeThe size of the font in pixels

If this is called using fonts, make sure to call textSize after calling textFont

 textSize(56);
+ text('Big Text', 50, 50);

textFont(font);

Set the font family

Arguments

fontThe font value returned when using loadFont

 textFont(myfont);
+ text('Hello world!', 100, 200);

text(str, x, y);

Draw text on the screen

Arguments

strString to render
xThe x position of the start of the text
yThe y position of the top of the text

Fonts are not yet implemented

 text('Hello lu5!', 40, 60);

\ No newline at end of file diff --git a/docs/v0.0.6/vector.html b/docs/v0.0.6/vector.html deleted file mode 100644 index 60de3741..00000000 --- a/docs/v0.0.6/vector.html +++ /dev/null @@ -1,23 +0,0 @@ -vector | lu5, a Lua Interpreter for Creative Coding

vector

v0.0.6
createVector(x, y);

Create a vector instance

Arguments

xThe first component of the vector
yThe second component of the vector

Returns

VectorThe created vector

 local a = createVector(3, 5);
- local b = createVector(1, 3);
- 
- local c = a:add(b);
- 
- print(c);

Vector.print();

Since a Vector implements a print method, it can be used in the print function

 local a = createVector(3, 5);
- 
- -- With print
- print(a);
-
- -- With class method
- Vector.print(a);
-
- -- with instance
- a:print();

Vector.mult(a, b);

No description

Arguments

aThe first vector
bThe second vector

Returns

VectorThe added vector

 local a = createVector(3, 5);
- local b = createVector(1, 3);
- 
- print(a:mult(b));
- print(Vector.mult(a, b));

Vector.add(a, b);

No description

Arguments

aThe first vector
bThe second vector

Returns

VectorThe multiplied vector

 local a = createVector(1, 4);
- local b = createVector(8, 2);
- 
- print(a:add(b));
- print(Vector.add(a, b));

\ No newline at end of file diff --git a/docs/v0.0.6/vector/index.html b/docs/v0.0.6/vector/index.html new file mode 100644 index 00000000..bd011902 --- /dev/null +++ b/docs/v0.0.6/vector/index.html @@ -0,0 +1,23 @@ +lu5 | vector

vector

v0.0.6
createVector(x, y);

Create a vector instance

Arguments

xThe first component of the vector
yThe second component of the vector

Returns

VectorThe created vector

 local a = createVector(3, 5);
+ local b = createVector(1, 3);
+ 
+ local c = a:add(b);
+ 
+ print(c);

Vector.print();

Since a Vector implements a print method, it can be used in the print function

 local a = createVector(3, 5);
+ 
+ -- With print
+ print(a);
+
+ -- With class method
+ Vector.print(a);
+
+ -- with instance
+ a:print();

Vector.mult(a, b);

No description

Arguments

aThe first vector
bThe second vector

Returns

VectorThe added vector

 local a = createVector(3, 5);
+ local b = createVector(1, 3);
+ 
+ print(a:mult(b));
+ print(Vector.mult(a, b));

Vector.add(a, b);

No description

Arguments

aThe first vector
bThe second vector

Returns

VectorThe multiplied vector

 local a = createVector(1, 4);
+ local b = createVector(8, 2);
+ 
+ print(a:add(b));
+ print(Vector.add(a, b));

\ No newline at end of file diff --git a/docs/v0.0.6/window.html b/docs/v0.0.6/window.html deleted file mode 100644 index 7f1035aa..00000000 --- a/docs/v0.0.6/window.html +++ /dev/null @@ -1,52 +0,0 @@ -window | lu5, a Lua Interpreter for Creative Coding

window

v0.0.6
createWindow(w, h);

Create a GLFW window.

Arguments

wWindow width
hWindow height

It is also possible to create a window in the global scope without defining a setup function.

 function setup()
-   -- Create the window here
-   createWindow(600, 600);
- end
-
- function draw()
-   -- draw things
- end

frameRate(fps);

Set the frame rate

Arguments

fpsThe frame rate to set

If frame rate is called without an argument, it will return frame per seconds

 x = 0;
-
- function setup()
-   createWindow(400, 400);
-   frameRate(24);
- end
-
- function draw()
-   background(51);
-   text('fps: ' .. frameRate(), 20, 10);
-
-   circle(x, 200, 32);
-   x = x + 1;
- end

deltaTimeGlobal

Elapsed 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(51);
-
-   circle(x, height/2, 32);
-
-   -- Get the same velocity with different framerates
-   x = x + vx deltaTime;
- end

widthGlobal

The window's width in pixels. If no window was created, this value is nil

 createWindow(800, 600);
-
- print(width);
- -- 800

heightGlobal

The window's height in pixels. If no window was created, this value is nil

 createWindow(800, 600);
-
- print(height);
- -- 600

windowResized();Event

Called when the window is resized

 function setup()
-     createWindow(500, 500);
- end
- 
- function draw()
-     background(51)
- end
- 
- function windowResized()
-     print('Resized!')
- end

\ No newline at end of file diff --git a/docs/v0.0.6/window/index.html b/docs/v0.0.6/window/index.html new file mode 100644 index 00000000..54ef54cf --- /dev/null +++ b/docs/v0.0.6/window/index.html @@ -0,0 +1,52 @@ +lu5 | window

window

v0.0.6
createWindow(w, h);

Create a GLFW window.

Arguments

wWindow width
hWindow height

It is also possible to create a window in the global scope without defining a setup function.

 function setup()
+   -- Create the window here
+   createWindow(600, 600);
+ end
+
+ function draw()
+   -- draw things
+ end

frameRate(fps);

Set the frame rate

Arguments

fpsThe frame rate to set

If frame rate is called without an argument, it will return frame per seconds

 x = 0;
+
+ function setup()
+   createWindow(400, 400);
+   frameRate(24);
+ end
+
+ function draw()
+   background(51);
+   text('fps: ' .. frameRate(), 20, 10);
+
+   circle(x, 200, 32);
+   x = x + 1;
+ end

deltaTimeGlobal

Elapsed 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(51);
+
+   circle(x, height/2, 32);
+
+   -- Get the same velocity with different framerates
+   x = x + vx deltaTime;
+ end

widthGlobal

The window's width in pixels. If no window was created, this value is nil

 createWindow(800, 600);
+
+ print(width);
+ -- 800

heightGlobal

The window's height in pixels. If no window was created, this value is nil

 createWindow(800, 600);
+
+ print(height);
+ -- 600

windowResized();Event

Called when the window is resized

 function setup()
+     createWindow(500, 500);
+ end
+ 
+ function draw()
+     background(51)
+ end
+ 
+ function windowResized()
+     print('Resized!')
+ end

\ No newline at end of file diff --git a/docs/v0.0.7/classes.html b/docs/v0.0.7/classes.html deleted file mode 100644 index fe4bfbef..00000000 --- a/docs/v0.0.7/classes.html +++ /dev/null @@ -1,27 +0,0 @@ -classes | lu5, a Lua Interpreter for Creative Coding

classes

v0.0.7
class(name);

Create a class.
if a class implements a print method, it can be used in the print function

Arguments

nameThe class name

 local Player = class('Player');
-
- function Player:init(x, y)
-   self.x = x;
-   self.y = y;
-   return self;
- end
-
- function Player:draw()
-   circle(self.x, self.y, 16);
- end
-
-
- -- Create 2 players and draw them
- local p1 = Player:new(100, 200);
- local p2 = Player:new(300, 200);
-
- function setup()
-   createWindow(400, 400);
- end
- 
- function draw()
-   background(51);
-
-   p1:draw();
-   p2:draw();
- end

\ No newline at end of file diff --git a/docs/v0.0.7/image.html b/docs/v0.0.7/image.html deleted file mode 100644 index 9a3a49b9..00000000 --- a/docs/v0.0.7/image.html +++ /dev/null @@ -1,10 +0,0 @@ -image | lu5, a Lua Interpreter for Creative Coding

image

v0.0.7
loadImage(path);

Load a png or jpeg image

Arguments

pathThe local image path

Returns

imgThe image reference

 function setup()
-   createWindow(600, 600);
-   img = loadImage('/path/to/mypic.png');
- end
-
- function draw()
-   background(51);
-
-   image(img, 0, 0);
- end   

image(image, x, y, [w], [h]);

Draw an image to the screen

Arguments

imageThe image reference
xThe x position of the image
yThe y position of the image
[w]The width of the image, if not specified, using source width
[h]The height of the image, if not specified, using source height


\ No newline at end of file diff --git a/docs/v0.0.7/index.html b/docs/v0.0.7/index.html deleted file mode 100644 index 6e7c921d..00000000 --- a/docs/v0.0.7/index.html +++ /dev/null @@ -1 +0,0 @@ -Reference | lu5, a Lua Interpreter for Creative Coding

Reference

v0.0.7

classes

\ No newline at end of file diff --git a/docs/v0.0.7/io.html b/docs/v0.0.7/io.html deleted file mode 100644 index 823fd71a..00000000 --- a/docs/v0.0.7/io.html +++ /dev/null @@ -1,9 +0,0 @@ -io | lu5, a Lua Interpreter for Creative Coding

io

v0.0.7
print(value);

Printing utility, can take any lua type.

Arguments

valueThe value to print to stdout

 print(42);
-
- print(1, 2, 3);
- 
- print('Hello world');
-
- print({ 3, 8, 1 });

loadText(file_path);

Read a file as a string

Arguments

file_pathThe path of the file

 file = loadText("./your-file.txt");
- print(file)

loadStrings(file_path);

Read a file as an array of strings split by line

Arguments

file_pathThe path of the file

 file = loadStrings("./your-file.txt");
- print(file)

\ No newline at end of file diff --git a/docs/v0.0.7/keyboard.html b/docs/v0.0.7/keyboard.html deleted file mode 100644 index 031e0067..00000000 --- a/docs/v0.0.7/keyboard.html +++ /dev/null @@ -1,19 +0,0 @@ -keyboard | lu5, a Lua Interpreter for Creative Coding

keyboard

v0.0.7
keyIsDown(k);

Check if a keyboard key is pressed, returns true if key is down and returns false if it's not

Arguments

kThe keyboard key to check as a key global, or a string

Returns

booleanWhether or not the key is down

 -- Use a string 
- if (keyIsDown('a')) then
-   -- key 'a' is down
- end
-
- -- use a global
- if (keyIsDown(LEFT_ARROW)) then
-   -- left arrow is down
- end

keyPressed(key, keyCode);Event

Called whenever a key is pressed.

Arguments

keyThe pressed key as a string, is nil if glfw cannot find a name for the key
keyCodeThe pressed key as a key code

 function setup()
-    createWindow(600, 600);
- end
- 
- function draw()
-    background(51);
- end
- 
- function keyPressed(key, keyCode)
-    print(key, keyCode)
- end

keyReleased(key, keyCode);Event

Called whenever a key is released.

Arguments

keyThe released key as a string, is nil if glfw cannot find a name for the key
keyCodeThe released key as a key code


keyHeld(key, keyCode);Event

Called whenever a key is held down.

Arguments

keyThe held key as a string, is nil if glfw cannot find a name for the key
keyCodeThe held key as a key code


UP_ARROWGlobal

No description


DOWN_ARROWGlobal

No description


LEFT_ARROWGlobal

No description


RIGHT_ARROWGlobal

No description


KEY_ENTERGlobal

No description


KEY_BACKSPACEGlobal

No description


KEY_AGlobal

No description


KEY_BGlobal

No description


KEY_CGlobal

No description


KEY_DGlobal

No description


KEY_EGlobal

No description


KEY_FGlobal

No description


KEY_GGlobal

No description


KEY_HGlobal

No description


KEY_IGlobal

No description


KEY_JGlobal

No description


KEY_KGlobal

No description


KEY_LGlobal

No description


KEY_MGlobal

No description


KEY_NGlobal

No description


KEY_OGlobal

No description


KEY_PGlobal

No description


KEY_QGlobal

No description


KEY_RGlobal

No description


KEY_SGlobal

No description


KEY_TGlobal

No description


KEY_UGlobal

No description


KEY_VGlobal

No description


KEY_WGlobal

No description


KEY_XGlobal

No description


KEY_YGlobal

No description


KEY_ZGlobal

No description


\ No newline at end of file diff --git a/docs/v0.0.7/mouse.html b/docs/v0.0.7/mouse.html deleted file mode 100644 index 952679d6..00000000 --- a/docs/v0.0.7/mouse.html +++ /dev/null @@ -1,50 +0,0 @@ -mouse | lu5, a Lua Interpreter for Creative Coding

mouse

v0.0.7
mouseXGlobal

The x mouse coordinate

 createWindow(400, 400);
-
- function draw()
-   background(51);
-   
-   line(mouseX, 0, mouseX, height);
- end

mouseYGlobal

The y mouse coordinate

 createWindow(400, 400);
-
- function draw()
-   background(51);
-   
-   line(0, mouseY, width, mouseY);
- end

mouseIsPressedGlobal

Is true when the mouse is pressed, is false when it's not


mousePressed(button);Event

Called when a mouse button is pressed.

Arguments

buttonThe pressed mouse button


-In the following example, the circle's size increases when the user clicks the mouse.

 size = 0;
-
- function setup()
-   createWindow(400, 400);
- end
-
- function draw()
-   background(51);
-
-   circle(mouseX, mouseY, size);
- end
-
- -- Increase circle size when mouse pressed
- function mousePressed()
-   size = size + 1;
- end

mouseReleased(button);Event

Called when a mouse button is released.

Arguments

buttonThe released mouse button


-In the following example, the circle's size increases when the user clicks the mouse.

 size = 32;
-
- function setup()
-   createWindow(400, 400);
- end
-
- function draw()
-   background(51);
-
-   circle(mouseX, mouseY, size);
- end
-
- -- Set larger circle size
- function mousePressed()
-   size = 64;
- end
-
- -- Reset size
- function mouseReleased()
-   size = 32;
- end

\ No newline at end of file diff --git a/docs/v0.0.7/setting.html b/docs/v0.0.7/setting.html deleted file mode 100644 index 3c123680..00000000 --- a/docs/v0.0.7/setting.html +++ /dev/null @@ -1,3 +0,0 @@ -setting | lu5, a Lua Interpreter for Creative Coding

setting

v0.0.7
background(r, g, b, a);

Clear a background with a color

Arguments

rThe red byte
gThe green byte
bThe blue byte
aThe alpha byte


fill(r, g, b, [a]);

Set the fill color for shapes

Arguments

rThe red byte
gThe green byte
bThe blue byte
[a]The alpha byte

Can also accept a hexadecimal or color name as string

 fill(255, 150, 40);
- square(200, 200, 64);

strokeWeight(weight);

No description

Arguments

weightThe line width in pixels

 strokeWeight(8);
- line(200, 200, mouseX, mouseY);

noFill();

Disable fill


stroke(r, g, b, a);

Set the stroke color for shapes

Arguments

rThe red byte
gThe green byte
bThe blue byte
aThe alpha byte

Only implemented for line and circle


noStroke();

Disable stroke
Only implemented for line and circle


push();

Save the style settings


pop();

Restore the style settings


\ No newline at end of file diff --git a/docs/v0.0.7/shapes.html b/docs/v0.0.7/shapes.html deleted file mode 100644 index 43be24b1..00000000 --- a/docs/v0.0.7/shapes.html +++ /dev/null @@ -1,7 +0,0 @@ -shapes | lu5, a Lua Interpreter for Creative Coding

shapes

v0.0.7
circle(x, y, d);

Draw a circle to the opengl context

Arguments

xThe x position of the circle
yThe y position of the circle
dThe diameter of the circle


rect(x, y, w, h);

Draw a rectangle to the opengl context

Arguments

xThe x position of the reactangle
yThe y position of the reactangle
wThe width
hThe height


square(x, y, s);

Draw a square to the opengl context

Arguments

xThe x position of the square
yThe y position of the square
sThe size of the square


line(x1, y1, x2, y2);

Draw a line to the opengl context

Arguments

x1The x position of the first point
y1The y position of the first point
x2The x position of the second point
y2The y position of the second point


quad(x1, y1, x2, y2, x3, y3, x4, y4);

Draw a quad on the screen

Arguments

x1The x position of the first point
y1The y position of the first point
x2The x position of the second point
y2The y position of the second point
x3The x position of the third point
y3The y position of the third point
x4The x position of the fourth point
y4The y position of the fourth point


point();

Draw a point on the screen


arc();

Draw an arc on the screen


ellipse();

Draw an ellipse on the screen


triangle();

Draw a triangle on the screen


beginShape(mode);

Begin adding vertices to a custom shape

Arguments

modeThe opengl shape mode LINES, POINTS, QUADS, TRIANGLES, TRIANGLE_FAN

The following would draw a 100 by 100 square at position 100, 100 -The following would draw a 100 by 100 square at position 100, 100

 beginShape(QUADS);
-   vertex(100, 100);
-   vertex(100, 200);
-   vertex(200, 200);
-   vertex(200, 100);
- endShape();

vertex(x, y);

beginShape must be called prior
Adding a vertex to a custom shape

Arguments

xThe x position
yThe y position


endShape();

beginShape must be called prior
Close the custom shape


\ No newline at end of file diff --git a/docs/v0.0.7/typography.html b/docs/v0.0.7/typography.html deleted file mode 100644 index 3a42f697..00000000 --- a/docs/v0.0.7/typography.html +++ /dev/null @@ -1,13 +0,0 @@ -typography | lu5, a Lua Interpreter for Creative Coding

typography

v0.0.7
loadFont(path);

Load a font

Arguments

pathThe font path on the local system

Returns

fontThe image reference

 function setup()
-   createWindow(600, 600);
-   font = loadFont('/path/to/myfont.ttf');
- end
-
- function draw()
-   background(51);
-
-   textFont(font);
-   text('Hello from lu5!', 30, 50);
- end   

textSize(size);

Set the font size

Arguments

sizeThe size of the font in pixels

If this is called using fonts, make sure to call textSize after calling textFont

 textSize(56);
- text('Big Text', 50, 50);

textFont(font);

Set the font family

Arguments

fontThe font value returned when using loadFont

 textFont(myfont);
- text('Hello world!', 100, 200);

text(str, x, y);

Draw text on the screen

Arguments

strString to render
xThe x position of the start of the text
yThe y position of the top of the text

Fonts are not yet implemented

 text('Hello lu5!', 40, 60);

\ No newline at end of file diff --git a/docs/v0.0.7/vector.html b/docs/v0.0.7/vector.html deleted file mode 100644 index 7e47b698..00000000 --- a/docs/v0.0.7/vector.html +++ /dev/null @@ -1,23 +0,0 @@ -vector | lu5, a Lua Interpreter for Creative Coding

vector

v0.0.7
createVector(x, y);

Create a vector instance

Arguments

xThe first component of the vector
yThe second component of the vector

Returns

VectorThe created vector

 local a = createVector(3, 5);
- local b = createVector(1, 3);
- 
- local c = a:add(b);
- 
- print(c);

Vector.print();

Since a Vector implements a print method, it can be used in the print function

 local a = createVector(3, 5);
- 
- -- With print
- print(a);
-
- -- With class method
- Vector.print(a);
-
- -- with instance
- a:print();

Vector.mult(a, b);

No description

Arguments

aThe first vector
bThe second vector

Returns

VectorThe added vector

 local a = createVector(3, 5);
- local b = createVector(1, 3);
- 
- print(a:mult(b));
- print(Vector.mult(a, b));

Vector.add(a, b);

No description

Arguments

aThe first vector
bThe second vector

Returns

VectorThe multiplied vector

 local a = createVector(1, 4);
- local b = createVector(8, 2);
- 
- print(a:add(b));
- print(Vector.add(a, b));

\ No newline at end of file diff --git a/docs/v0.0.7/window.html b/docs/v0.0.7/window.html deleted file mode 100644 index 8ce79f9b..00000000 --- a/docs/v0.0.7/window.html +++ /dev/null @@ -1,52 +0,0 @@ -window | lu5, a Lua Interpreter for Creative Coding

window

v0.0.7
createWindow(w, h);

Create a GLFW window.

Arguments

wWindow width
hWindow height

It is also possible to create a window in the global scope without defining a setup function.

 function setup()
-   -- Create the window here
-   createWindow(600, 600);
- end
-
- function draw()
-   -- draw things
- end

frameRate(fps);

Set the frame rate

Arguments

fpsThe frame rate to set

If frame rate is called without an argument, it will return frame per seconds

 x = 0;
-
- function setup()
-   createWindow(400, 400);
-   frameRate(24);
- end
-
- function draw()
-   background(51);
-   text('fps: ' .. frameRate(), 20, 10);
-
-   circle(x, 200, 32);
-   x = x + 1;
- end

deltaTimeGlobal

Elapsed 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(51);
-
-   circle(x, height/2, 32);
-
-   -- Get the same velocity with different framerates
-   x = x + vx deltaTime;
- end

widthGlobal

The window's width in pixels. If no window was created, this value is nil

 createWindow(800, 600);
-
- print(width);
- -- 800

heightGlobal

The window's height in pixels. If no window was created, this value is nil

 createWindow(800, 600);
-
- print(height);
- -- 600

windowResized();Event

Called when the window is resized

 function setup()
-     createWindow(500, 500);
- end
- 
- function draw()
-     background(51)
- end
- 
- function windowResized()
-     print('Resized!')
- end

\ No newline at end of file