Custom Types
Orbit does not use types like Vector3D or ImColor in the traditional sense. You cannot access a Vector3D element using the following code.
local function Function()
local Vector = Vector3D(1.0, 1.0, 1.0)
Print(tostring(Vector.x)) --this will give you an error
end
Orbit stores these types in arrays instead. Be sure to remember that tables start with an index of 1 in LUA, unlike other programming languages.
local function Function()
local Vector = Vector3D(1.0, 1.0, 1.0)
Print(tostring(Vector[1])) --this will give you the value x
end
The elements of a Vector2D type are ints.
local Vector = Vector2D(1, 1)
Print(tostring(Vector[1])) --X value
Print(tostring(Vector[2])) --Y value
The elements of a Vector3D type are floats.
local Vector = Vector3D(1.0, 1.0, 1.0)
Print(tostring(Vector[1])) --X value
Print(tostring(Vector[2])) --Y value
Print(tostring(Vector[3])) --Z value
The elements of a Color type are ints.
local White = Color(255, 255, 255, 255)
Print(tostring(White[1])) --Red value
Print(tostring(White[2])) --Green value
Print(tostring(White[3])) --Blue value
Print(tostring(White[4])) --Alpha value
Last updated on
Was this page helpful?