math.length_squared

Computes the squared length of a 2D vector.

Usage

math.length_squared(x, y)

Arguments

Name Type Description
x number X coordinate of the vector.
y number Y coordinate of the vector.

Returns

Name Type Description
length_squared number Vector length squared.

Examples

local d = math.length_squared(0, 5);
print(d); -- Prints "25" (5^2)

This site uses Just the Docs, a documentation theme for Jekyll.