Yuari
Documentation
Docs/Data types

Data types

Roblox-style value types implemented as VM userdata, with full operator overloading and typeof support. Includes Vector3, Vector2, Color3, CFrame, UDim2 and RaycastParams.

Vector3

MemberDescription
Vector3.new(x?, y?, z?)Constructor (also callable directly: Vector3(1,2,3)). Copy-constructs from another Vector3.
local v = Vector3.new(1, 2, 3)
print(v.X, v.Y, v.Z, v.Magnitude)
.X .Y .ZComponents (also lowercase).
.MagnitudeLength of the vector.
.UnitNormalized copy (zero vector if length ≈ 0).
:Dot(other)Dot product.
local a = Vector3.new(1, 0, 0)
local b = Vector3.new(0, 1, 0)
print(a:Dot(b), a:Cross(b), a:Lerp(b, 0.5))
:Cross(other)Cross product.
:Lerp(other, alpha)Linear interpolation.
:Angle / :Min / :Max / :Floor / :Ceil / :AbsAngle between vectors and component-wise helpers.
print(Vector3.new(1, 0, 0):Angle(Vector3.new(0, 1, 0)))
print(Vector3.new(-1.2, 2.7, 0):Floor())
Operators+ - * /, unary -, == (* also accepts a scalar).
ConstantsVector3.zero, .one, .xAxis, .yAxis, .zAxis

Vector2

MemberDescription
Vector2.new(x?, y?)Constructor.
local v = Vector2.new(100, 50)
print(v.X, v.Y)
.X .Y .MagnitudeComponents and length.
.Unit / :Lerp / :Dot / :Cross / -v / ==Unit vector, interpolation, products and operators.
local a = Vector2.new(3, 4)
print(a.Unit, a:Dot(Vector2.new(1, 0)))
Operators+ - * /, unary -, == (* accepts a scalar).

Color3

MemberDescription
Color3.new(r?, g?, b?)Components in 0–1 range.
local color = Color3.new(1, 0.5, 0.25)
print(color.R, color.G, color.B)
Color3.fromRGB(r, g, b)Components in 0–255 range.
local color = Color3.fromRGB(255, 80, 40)
print(color:ToRGB())
Color3.fromHSV(h, s, v)Hue, saturation and value in 0–1 range.
local color = Color3.fromHSV(0.58, 0.8, 1)
print(color.R, color.G, color.B)
.R .G .BComponents (also lowercase).
:ToRGB()Returns three integers 0–255.
:Lerp(other, alpha) / :ToHSV()Color interpolation and RGB→HSV conversion.
print(Color3.fromRGB(255, 0, 0):ToHSV())  -- 0, 1, 1

CFrame

MemberDescription
CFrame.new(position?)From a Vector3, three numbers, or empty (identity).
local cf = CFrame.new(Vector3.new(0, 5, 0))
print(cf.Position)
CFrame.lookAt(from, to)Position + look-at rotation.
local cf = CFrame.lookAt(Vector3.new(0, 5, 0), Vector3.new(10, 5, 0))
print(cf.LookVector)
CFrame.Angles(x?, y?, z?)Euler-angles rotation CFrame.
local cf = CFrame.Angles(0, math.rad(90), 0)
print(cf.LookVector)
.Position / .pPosition vector. .X .Y .Z also work.
.LookVector .RightVector .UpVectorRotation axes. .XVector, .YVector and .ZVector are aliases of the matrix columns.
.RotationCopy with the position reset to zero.
:PointToWorldSpace(v) / :PointToObjectSpace(v)Coordinate-space conversion.
local cf = CFrame.new(10, 0, 0)
local world = cf:PointToWorldSpace(Vector3.new(1, 0, 0))
local object = cf:PointToObjectSpace(world)
print(world, object)
:ToEulerAnglesXYZ()Euler angles.
local cf = CFrame.Angles(0, math.rad(45), 0)
print(cf:ToEulerAnglesXYZ())
CFrame.identity / fromAxisAngle / fromMatrix / fromEulerAnglesXYZ / fromEulerAnglesYXZIdentity constant and rotation constructors.
local cf = CFrame.fromAxisAngle(Vector3.new(0, 1, 0), math.rad(90))
print(cf.LookVector.X)
:GetComponents / :Inverse / :Lerp / :ToWorldSpace / :ToObjectSpace / :ToOrientation / :ToAxisAngleMatrix access, inversion, slerp interpolation, space conversion and rotation extraction, plus cf + Vector3 / cf - Vector3.
local cf = CFrame.new(10, 0, 0)
print(cf:Inverse().Position)
print((cf + Vector3.new(0, 2, 0)).Position)
Operatorscf * Vector3 (transform point), cf * CFrame (compose), cf + Vector3 / cf - Vector3 (translate).

UDim

MemberDescription
UDim.new(scale?, offset?)Scale/offset pair. UDim.fromScale(s) and UDim.fromOffset(o) fill the other component with zero.
local u = UDim.new(0.5, 10)
print(u.Scale, u.Offset, typeof(u))
.Scale .OffsetRead-only numeric components.

UDim2

MemberDescription
UDim2.new(xScale?, xOffset?, yScale?, yOffset?)2D position/size value. Also callable directly: UDim2(0.5, 0, 0.5, 0).
local size = UDim2.new(0.5, 0, 0, 120)
print(size.X.Scale, size.Y.Offset)
UDim2.fromScale(x?, y?)Both offsets zero.
UDim2.fromOffset(x?, y?)Both scales zero.
.XScale .XOffset .YScale .YOffsetNumeric components.
.X .Y .Width .HeightUDim-style tables with Scale and Offset.

RaycastParams

MemberDescription
RaycastParams.new()Creates a parameter table.
local params = RaycastParams.new()
params.FilterDescendantsInstances = { workspace.Model }
params.IgnoreWater = true
FieldsFilterDescendantsInstances, FilterType, IgnoreWater, CollisionGroup, RespectCanCollide, BruteForceAllSlow