Under the hood in Luau, vector and Vector3 are one and the same. This won’t ever be changed due to backwards compatibility necessities. Would you want all code expecting typeof(vec3) == "Vector3" to start failing?
type will always give you the primitive name of the type, while typeof gives you the decorated name of the type. Passing a Vector3 into type will give you `vector’.
I don’t think this entirely makes sense here because the vector library is very new to rblx luau, so most things built this way shouldn’t accept vector objects anyways if they expect a Vector3.
Because of this, your example of typeof(vec3) would only actually return something different if using this new type that should already be incompatible with old code.
Not sure if I worded that right, but I agree with this request and it would be nice as the vector library is still new and this shouldn’t be a breaking change
That’s definitely a new one. I do agree there needs to be cross compatibility between the two at all times, but do keep in mind there’s also a vector.sign function that should consume both.
Right now the type annotations are busted and that needs to be fixed on their end, but it otherwise should work.
There’s also the issue of some things returning a Vector3 when inputting a vector or visa versa. For example setting an attribute using a vector returns a Vector3 when getting that same attribute.
That is beyond just the type check though, it’s the object itself.
The Vector3 and vector classes are a lot more interchangeable than I remember them being. Seems like you can throw either into the vector library, use the methods, and get properties included in either.
I remember it erroring when you tried to do those things but they work together fine so I suppose it doesn’t matter which is which, just how you use it.
They definitely made some last minute changes because I remember vectors being separate enough that they would error where they don’t anymore… It’s definitely a good thing Vector3s work with the vector library now though
Ex: vector.magnitude() is significantly faster than Vector3.Magnitude (about 2-3x boost), and similar with other functions. This is an important thing for some performance-intensive tasks
typeof returns Vector3 to preserve backwards compatibility. type was changed because it wasn’t very useful in the past when it returned ‘userdata’, but we still had an announcement for that change: Behavior change: type() will start returning 'vector' for Vector3