Point Type

Point

Represents a 2D point with x and y coordinates, typically used for screen coordinates.

Fields

FieldTypeDescription
xnumberX coordinate
ynumberY coordinate

Methods

distance_to(other)

Calculate distance to another point.

Parameters:

NameTypeDescription
otherPointThe other point

Returns: number - The Euclidean distance

Example:

local p1 = {x = 100, y = 100}
local p2 = {x = 200, y = 200}
local dist = p1:distance_to(p2)
print("Distance:", dist) -- ~141.42

Usage

Points are typically used for screen coordinates returned by entity methods:

local player = players:local_player()
local x, y = player:base_point()
print(string.format("Player screen position: (%d, %d)", x, y))