Nocare3/love2dapi_chunks huggingface dataset:
love.math.getRandomState
Gets the current state of the random number generator. This returns an opaque implementation-dependent string which is only useful for later use with love.math.setRandomState or RandomGenerator:setState.

This is different from love.math.getRandomSeed in that getRandomState gets the random number generator's current state, whereas getRandomSeed gets the previously set seed number.
state = love.math.getRandomState()
state string The current state of the random number generator, represented as a string.
love.math.isConvex
Checks whether a polygon is convex.

PolygonShapes in love.physics, some forms of Meshes, and polygons drawn with love.graphics.polygon must be simple convex polygons.
convex = love.math.isConvex( vertices )
vertices table The vertices of the polygon as a table in the form of {x1, y1, x2, y2, x3, y3, ...}.
convex boolean Whether the given polygon is convex.
convex = love.math.isConvex( x1, y1, x2, y2, ... )
x1 number The position of the first vertex of the polygon on the x-axis.
y1 number The position of the first vertex of the polygon on the y-axis.
x2 number The position of the second vertex of the polygon on the x-axis.
y2 number The position of the second vertex of the polygon on the y-axis.
... number Additional position of the vertex of the polygon on the x-axis and y-axis.
convex boolean Whether the given polygon is convex.
love.math.linearToGamma
Converts a color from linear-space (RGB) to gamma-space (sRGB). This is useful when storing linear RGB color values in an image, because the linear RGB color space has less precision than sRGB for dark colors, which can result in noticeable color banding when drawing.

In general, colors chosen based on what they look like on-screen are already in gamma-space and should not be double-converted. Colors calculated using math are often in the linear RGB space.

Read more about gamma-correct rendering here, here, and here.

In versions prior to 11.0, color component values were within the range of 0 to 255 instead of 0 to 1.
cr, cg, cb = love.math.linearToGamma( lr, lg, lb )
lr number The red channel of the linear RGB color to convert.
lg number The green channel of the linear RGB color to convert.
lb number The blue channel of the linear RGB color to convert.
cr number The red channel of the converted color in gamma sRGB space.
cg number The green channel of the converted color in gamma sRGB space.
cb number The blue channel of the converted color in gamma sRGB space.
cr, cg, cb = love.math.linearToGamma( color )
color table An array with the red, green, and blue channels of the linear RGB color to convert.
cr number The red channel of the converted color in gamma sRGB space.
cg number The green channel of the converted color in gamma sRGB space.
cb number The blue channel of the converted color in gamma sRGB space.
c = love.math.linearToGamma( lc )
lc number The value of a color channel in linear RGB space to convert.
c number The value of the color channel in gamma sRGB space.
love.math.newBezierCurve
Creates a new BezierCurve object.

The number of vertices in the control polygon determines the degree of the curve, e.g. three vertices define a quadratic (degree 2) Bézier curve, four vertices define a cubic (degree 3) Bézier curve, etc.
curve = love.math.newBezierCurve( vertices )
vertices table The vertices of the control polygon as a table in the form of {x1, y1, x2, y2, x3, y3, ...}.
curve BezierCurve A Bézier curve object.
curve = love.math.newBezierCurve( x1, y1, x2, y2, ... )
x1 number The position of the first vertex of the control polygon on the x-axis.
y1 number The position of the first vertex of the control polygon on the y-axis.
x2 number The position of the second vertex of the control polygon on the x-axis.
y2 number The position of the second vertex of the control polygon on the y-axis.
... number Additional position of the vertex of the control polygon on the x-axis and y-axis.
curve BezierCurve A Bézier curve object.
love.math.newRandomGenerator
Creates a new RandomGenerator object which is completely independent of other RandomGenerator objects and random functions.
rng = love.math.newRandomGenerator()
rng RandomGenerator The new Random Number Generator object.
rng = love.math.newRandomGenerator( seed )
seed number The initial seed number to use for this object.
rng RandomGenerator The new Random Number Generator object.
rng = love.math.newRandomGenerator( low, high )
low number The lower 32 bits of the seed number to use for this object.
high number The higher 32 bits of the seed number to use for this object.
rng RandomGenerator The new Random Number Generator object.
love.math.newTransform
Creates a new Transform object.
transform = love.math.newTransform()
transform Transform The new Transform object.
transform = love.math.newTransform( x, y, angle, sx, sy, ox, oy, kx, ky )
x number The position of the new Transform on the x-axis.
y number The position of the new Transform on the y-axis.
angle (0) number The orientation of the new Transform in radians.
sx (1) number Scale factor on the x-axis.
sy (sx) number Scale factor on the y-axis.
ox (0) number Origin offset on the x-axis.
oy (0) number Origin offset on the y-axis.
kx (0) number Shearing / skew factor on the x-axis.
ky (0) number Shearing / skew factor on the y-axis.
transform Transform The new Transform object.
love.math.noise
Generates a Simplex or Perlin noise value in 1-4 dimensions. The return value will always be the same, given the same arguments.

Simplex noise is closely related to Perlin noise. It is widely used for procedural content generation.

There are many webpages which discuss Perlin and Simplex noise in detail.
value = love.math.noise( x )
x number The number used to generate the noise value.
value number The noise value in the range of 1.
value = love.math.noise( x, y )
x number The first value of the 2-dimensional vector used to generate the noise value.
y number The second value of the 2-dimensional vector used to generate the noise value.
value number The noise value in the range of 1.
value = love.math.noise( x, y, z )
x number The first value of the 3-dimensional vector used to generate the noise value.
y number The second value of the 3-dimensional vector used to generate the noise value.
z number The third value of the 3-dimensional vector used to generate the noise value.
value number The noise value in the range of 1.
value = love.math.noise( x, y, z, w )
x number The first value of the 4-dimensional vector used to generate the noise value.
y number The second value of the 4-dimensional vector used to generate the noise value.
z number The third value of the 4-dimensional vector used to generate the noise value.
w number The fourth value of the 4-dimensional vector used to generate the noise value.
value number The noise value in the range of 1.
love.math.random
Generates a pseudo-random number in a platform independent manner. The default love.run seeds this function at startup, so you generally don't need to seed it yourself.
number = love.math.random()
number number The pseudo-random number.
number = love.math.random( max )
max number The maximum possible value it should return.
number number The pseudo-random integer number.
number = love.math.random( min, max )
min number The minimum possible value it should return.
max number The maximum possible value it should return.
number number The pseudo-random integer number.
love.math.randomNormal
Get a normally distributed pseudo random number.
number = love.math.randomNormal( stddev, mean )
stddev (1) number Standard deviation of the distribution.
mean (0) number The mean of the distribution.
number number Normally distributed random number with variance (stddev)² and the specified mean.
love.math.setRandomSeed
Sets the seed of the random number generator using the specified integer number. This is called internally at startup, so you generally don't need to call it yourself.
love.math.setRandomSeed( seed )
seed number The integer number with which you want to seed the randomization. Must be within the range of 2^53 - 1.
love.math.setRandomSeed( low, high )
low number The lower 32 bits of the seed value. Must be within the range of 2^32 - 1.
high number The higher 32 bits of the seed value. Must be within the range of 2^32 - 1.
love.math.setRandomState
Sets the current state of the random number generator. The value used as an argument for this function is an opaque implementation-dependent string and should only originate from a previous call to love.math.getRandomState.

This is different from love.math.setRandomSeed in that setRandomState directly sets the random number generator's current implementation-dependent state, whereas setRandomSeed gives it a new seed value.
love.math.setRandomState( state )
state string The new state of the random number generator, represented as a string. This should originate from a previous call to love.math.getRandomState.
love.math.triangulate
Decomposes a simple convex or concave polygon into triangles.
triangles = love.math.triangulate( polygon )
polygon table Polygon to triangulate. Must not intersect itself.
triangles table List of triangles the polygon is composed of, in the form of {{x1, y1, x2, y2, x3, y3}, {x1, y1, x2, y2, x3, y3}, ...}.
triangles = love.math.triangulate( x1, y1, x2, y2, x3, y3 )
x1 number The position of the first vertex of the polygon on the x-axis.
y1 number The position of the first vertex of the polygon on the y-axis.
x2 number The position of the second vertex of the polygon on the x-axis.
y2 number The position of the second vertex of the polygon on the y-axis.
x3 number The position of the third vertex of the polygon on the x-axis.
y3 number The position of the third vertex of the polygon on the y-axis.
triangles table List of triangles the polygon is composed of, in the form of {{x1, y1, x2, y2, x3, y3}, {x1, y1, x2, y2, x3, y3}, ...}.
BezierCurve:evaluate
Evaluate Bézier curve at parameter t. The parameter must be between 0 and 1 (inclusive).

This function can be used to move objects along paths or tween parameters. However it should not be used to render the curve, see BezierCurve:render for that purpose.
x, y = BezierCurve:evaluate( t )
t number Where to evaluate the curve.
x number x coordinate of the curve at parameter t.
y number y coordinate of the curve at parameter t.
BezierCurve:getControlPoint
Get coordinates of the i-th control point. Indices start with 1.
x, y = BezierCurve:getControlPoint( i )
i number Index of the control point.
x number Position of the control point along the x axis.
y number Position of the control point along the y axis.
BezierCurve:getControlPointCount
Get the number of control points in the Bézier curve.
count = BezierCurve:getControlPointCount()
count number The number of control points.
BezierCurve:getDegree
Get degree of the Bézier curve. The degree is equal to number-of-control-points - 1.
degree = BezierCurve:getDegree()
degree number Degree of the Bézier curve.
BezierCurve:getDerivative
Get the derivative of the Bézier curve.

This function can be used to rotate sprites moving along a curve in the direction of the movement and compute the direction perpendicular to the curve at some parameter t.
derivative = BezierCurve:getDerivative()
derivative BezierCurve The derivative curve.
BezierCurve:getSegment
Gets a BezierCurve that corresponds to the specified segment of this BezierCurve.
curve = BezierCurve:getSegment( startpoint, endpoint )
startpoint number The starting point along the curve. Must be between 0 and 1.
endpoint number The end of the segment. Must be between 0 and 1.
curve BezierCurve A BezierCurve that corresponds to the specified segment.
BezierCurve:insertControlPoint
Insert control point as the new i-th control point. Existing control points from i onwards are pushed back by 1. Indices start with 1. Negative indices wrap around: -1 is the last control point, -2 the one before the last, etc.
BezierCurve:insertControlPoint( x, y, i )
x number Position of the control point along the x axis.
y number Position of the control point along the y axis.
i (-1) number Index of the control point.
BezierCurve:removeControlPoint
Removes the specified control point.
BezierCurve:removeControlPoint( index )
index number The index of the control point to remove.
BezierCurve:render
Get a list of coordinates to be used with love.graphics.line.

This function samples the Bézier curve using recursive subdivision. You can control the recursion depth using the depth parameter.

If you are just interested to know the position on the curve given a parameter, use BezierCurve:evaluate.
coordinates = BezierCurve:render( depth )
depth (5) number Number of recursive subdivision steps.
coordinates table List of x,y-coordinate pairs of points on the curve.
BezierCurve:renderSegment
Get a list of coordinates on a specific part of the curve, to be used with love.graphics.line.

This function samples the Bézier curve using recursive subdivision. You can control the recursion depth using the depth parameter.

If you are just need to know the position on the curve given a parameter, use BezierCurve:evaluate.
coordinates = BezierCurve:renderSegment( startpoint, endpoint, depth )
startpoint number The starting point along the curve. Must be between 0 and 1.
endpoint number The end of the segment to render. Must be between 0 and 1.
depth (5) number Number of recursive subdivision steps.
coordinates table List of x,y-coordinate pairs of points on the specified part of the curve.
BezierCurve:rotate
Rotate the Bézier curve by an angle.
BezierCurve:rotate( angle, ox, oy )
angle number Rotation angle in radians.
ox (0) number X coordinate of the rotation center.
oy (0) number Y coordinate of the rotation center.
BezierCurve:scale
Scale the Bézier curve by a factor.
BezierCurve:scale( s, ox, oy )
s number Scale factor.
ox (0) number X coordinate of the scaling center.
oy (0) number Y coordinate of the scaling center.
BezierCurve:setControlPoint
Set coordinates of the i-th control point. Indices start with 1.
BezierCurve:setControlPoint( i, x, y )
i number Index of the control point.
x number Position of the control point along the x axis.
y number Position of the control point along the y axis.
BezierCurve:translate
Move the Bézier curve by an offset.
BezierCurve:translate( dx, dy )
dx number Offset along the x axis.
dy number Offset along the y axis.
RandomGenerator:getSeed
Gets the seed of the random number generator object.

The seed is split into two numbers due to Lua's use of doubles for all number values - doubles can't accurately represent integer values above 2^53, but the seed value is an integer number in the range of 2^64 - 1.
low, high = RandomGenerator:getSeed()
low number Integer number representing the lower 32 bits of the RandomGenerator's 64 bit seed value.
high number Integer number representing the higher 32 bits of the RandomGenerator's 64 bit seed value.
RandomGenerator:getState
Gets the current state of the random number generator. This returns an opaque string which is only useful for later use with RandomGenerator:setState in the same major version of LÖVE.

This is different from RandomGenerator:getSeed in that getState gets the RandomGenerator's current state, whereas getSeed gets the previously set seed number.
state = RandomGenerator:getState()
state string The current state of the RandomGenerator object, represented as a string.
RandomGenerator:random
Generates a pseudo-random number in a platform independent manner.
number = RandomGenerator:random()
number number The pseudo-random number.
number = RandomGenerator:random( max )
max number The maximum possible value it should return.
number number The pseudo-random integer number.
number = RandomGenerator:random( min, max )
min number The minimum possible value it should return.
max number The maximum possible value it should return.
number number The pseudo-random integer number.
RandomGenerator:randomNormal
Get a normally distributed pseudo random number.
number = RandomGenerator:randomNormal( stddev, mean )
stddev (1) number Standard deviation of the distribution.
mean (0) number The mean of the distribution.
number number Normally distributed random number with variance (stddev)² and the specified mean.
RandomGenerator:setSeed
Sets the seed of the random number generator using the specified integer number.
RandomGenerator:setSeed( seed )
seed number The integer number with which you want to seed the randomization. Must be within the range of 2^53.
RandomGenerator:setSeed( low, high )
low number The lower 32 bits of the seed value. Must be within the range of 2^32 - 1.
high number The higher 32 bits of the seed value. Must be within the range of 2^32 - 1.
RandomGenerator:setState
Sets the current state of the random number generator. The value used as an argument for this function is an opaque string and should only originate from a previous call to RandomGenerator:getState in the same major version of LÖVE.

This is different from RandomGenerator:setSeed in that setState directly sets the RandomGenerator's current implementation-dependent state, whereas setSeed gives it a new seed value.
RandomGenerator:setState( state )
state string The new state of the RandomGenerator object, represented as a string. This should originate from a previous call to RandomGenerator:getState.
Transform:apply
Applies the given other Transform object to this one.

This effectively multiplies this Transform's internal transformation matrix with the other Transform's (i.e. self * other), and stores the result in this object.
transform = Transform:apply( other )
other Transform The other Transform object to apply to this Transform.
transform Transform The Transform object the method was called on. Allows easily chaining Transform methods.
Transform:clone
Creates a new copy of this Transform.
clone = Transform:clone()
clone Transform The copy of this Transform.
Transform:getMatrix
Gets the internal 4x4 transformation matrix stored by this Transform. The matrix is returned in row-major order.
e1_1, e1_2, e1_3, e1_4, e2_1, e2_2, e2_3, e2_4, e3_1, e3_2, e3_3, e3_4, e4_1, e4_2, e4_3, e4_4 = Transform:getMatrix()
e1_1 number The first column of the first row of the matrix.
e1_2 number The second column of the first row of the matrix.
e1_3 number The third column of the first row of the matrix.
e1_4 number The fourth column of the first row of the matrix.
e2_1 number The first column of the second row of the matrix.
e2_2 number The second column of the second row of the matrix.
e2_3 number The third column of the second row of the matrix.
e2_4 number The fourth column of the second row of the matrix.
e3_1 number The first column of the third row of the matrix.
e3_2 number The second column of the third row of the matrix.
e3_3 number The third column of the third row of the matrix.
e3_4 number The fourth column of the third row of the matrix.
e4_1 number The first column of the fourth row of the matrix.
e4_2 number The second column of the fourth row of the matrix.
e4_3 number The third column of the fourth row of the matrix.
e4_4 number The fourth column of the fourth row of the matrix.
Transform:inverse
Creates a new Transform containing the inverse of this Transform.
inverse = Transform:inverse()
inverse Transform A new Transform object representing the inverse of this Transform's matrix.
Transform:inverseTransformPoint
Applies the reverse of the Transform object's transformation to the given 2D position.

This effectively converts the given position from the local coordinate space of the Transform into global coordinates.

One use of this method can be to convert a screen-space mouse position into global world coordinates, if the given Transform has transformations applied that are used for a camera system in-game.
globalX, globalY = Transform:inverseTransformPoint( localX, localY )
localX number The x component of the position with the transform applied.
localY number The y component of the position with the transform applied.
globalX number The x component of the position in global coordinates.
globalY number The y component of the position in global coordinates.
Transform:isAffine2DTransform
Checks whether the Transform is an affine transformation.
affine = Transform:isAffine2DTransform()
affine boolean true if the transform object is an affine transformation, false otherwise.
Transform:reset
Resets the Transform to an identity state. All previously applied transformations are erased.
transform = Transform:reset()
transform Transform The Transform object the method was called on. Allows easily chaining Transform methods.
Transform:rotate
Applies a rotation to the Transform's coordinate system. This method does not reset any previously applied transformations.
transform = Transform:rotate( angle )
angle number The relative angle in radians to rotate this Transform by.
transform Transform The Transform object the method was called on. Allows easily chaining Transform methods.
Transform:scale
Scales the Transform's coordinate system. This method does not reset any previously applied transformations.
transform = Transform:scale( sx, sy )
sx number The relative scale factor along the x-axis.
sy (sx) number The relative scale factor along the y-axis.
transform Transform The Transform object the method was called on. Allows easily chaining Transform methods.
Transform:setTransformation
Resets the Transform to the specified transformation parameters.
transform = Transform:setTransformation( x, y, angle, sx, sy, ox, oy, kx, ky )
x number The position of the Transform on the x-axis.
y number The position of the Transform on the y-axis.
angle (0) number The orientation of the Transform in radians.
sx (1) number Scale factor on the x-axis.
sy (sx) number Scale factor on the y-axis.
ox (0) number Origin offset on the x-axis.
oy (0) number Origin offset on the y-axis.
kx (0) number Shearing / skew factor on the x-axis.
ky (0) number Shearing / skew factor on the y-axis.
transform Transform The Transform object the method was called on. Allows easily chaining Transform methods.
Transform:shear
Applies a shear factor (skew) to the Transform's coordinate system. This method does not reset any previously applied transformations.
transform = Transform:shear( kx, ky )
kx number The shear factor along the x-axis.
ky number The shear factor along the y-axis.
transform Transform The Transform object the method was called on. Allows easily chaining Transform methods.
Transform:transformPoint
Applies the Transform object's transformation to the given 2D position.

This effectively converts the given position from global coordinates into the local coordinate space of the Transform.
localX, localY = Transform:transformPoint( globalX, globalY )
globalX number The x component of the position in global coordinates.
globalY number The y component of the position in global coordinates.
localX number The x component of the position with the transform applied.
localY number The y component of the position with the transform applied.
Transform:translate
Applies a translation to the Transform's coordinate system. This method does not reset any previously applied transformations.
transform = Transform:translate( dx, dy )
dx number The relative translation along the x-axis.
dy number The relative translation along the y-axis.
transform Transform The Transform object the method was called on. Allows easily chaining Transform methods.
love.mouse.getCursor
Gets the current Cursor.
cursor = love.mouse.getCursor()
cursor Cursor The current cursor, or nil if no cursor is set.
love.mouse.getPosition
Returns the current position of the mouse.
x, y = love.mouse.getPosition()
x number The position of the mouse along the x-axis.
y number The position of the mouse along the y-axis.