This is an old revision of the document!
Table of Contents
Data types
boolean
local value = true
integer
Integer number
local value = 42
float
Floating-point number with single precision
local value = 17.44
double
Floating-point number with double precision
local value = -61.7267023355
string
local value = "String value"
vec2i
2D integer vector
To initialize a vec2i
with x = 54
and y = 97
:
local value = { 54, 97 }
vec2f
2D float vector
To initialize a vec2f
with x = 73
and y = 15.66
:
local value = { 73.0, 15.66 }
vec3i
3D integer vector
To initialize a vec3i
with x = 19
, y = 86
and z = 45
:
local value = { 19, 86, 45 }
vec3f
3D float vector
To initialize a vec3f
with x = -15.71
, y = -71
and z = 93.03
:
local value = { -15.71, -71.0, 93.03 }
quaternion
4D float vector representing a rotation
To initialize a quaternion
with x = 0.302268
, y = 0.075567
, z = 0.6347627
and w = 0.7071068
:
local value = { 0.302268, 0.075567, 0.6347627, 0.7071068 }
Quaternion properties can also be set with a vec3f
containing the euler angles in degrees.
color
A color is stored as four float numbers, representing the four channels. Each channel can have a value superior to 1, in case of HDR use.
To initialize a color
with R = 1
, G = 0.549
, B = 0
and A = 0.9
(dark orange with 90% opacity; hex FF8C00E6
):
local value = { 1, 0.549, 0, 0.9 }
polygon
A 2D polygon is a list of 2D points (vec2f
) defining a shape.
To initialize a square polygon with a side length of 4.5
and centered around the point [1; 1]
:
local value = { { 5.5, 5.5 }, { 5.5, -3.5 }, { -3.5, -3.5 }, { -3.5, 5.5 } }
You can also create simple polygons with the following functions:
polygon.createRectangle(_size [, _offset])
Name | Type | Description |
---|---|---|
_size | vec2f | Size of the rectangle |
_offset | vec2f | Offset of the center of the rectange from [0; 0] |
polygon.createCircle(_radius [, _offset [, _step]])
Name | Type | Description |
---|---|---|
_radius | float | Radius of the circle |
_offset | vec2f | Offset of the center of the circle from [0; 0] |
_step | integer | Amount of sides of the circle |