Vector3:GetComponents()

Currently no function is available to return all of the components of a Vector3. However this functionality exists in CFrame.

It is possible to use this by constructing a CFrame from the Vector3 data type.

Example

local x, y, z = CFrame.new(Vector3.new(1,2,3)):GetComponents()

print(x,y,z) -- 1, 2, 3

Proposal

local x, y, z = Vector3.new(1,2,3):GetComponents()
print(x,y,z) -- prints 1, 2, 3

Why include this?

Overall I feel this would be adding syntactic sugar to the code by improving the readability of code written with a lot of Vector3/CFrame logic.

Secondly this would help to standardize functionality within Roblox because this could also be applied to some other Roblox data types to unpack its content as opposed to accessing each property directly.

29 Likes