Here’s something I just threw together. It might work.
function setup()
a=vec4(5,6,7,3)
print(vecType(a))
a=vec3(5,9,3)
print(vecType(a))
a=vec2(5,9)
print(vecType(a))
end
function vecType(v)
if v.w ~= nil then
return 4
elseif v.z ~= nil then
return 3
elseif v.y ~= nil then
return 2
end
end
Yes, I guess you have to find some unique properties to find out what type it is. You have to check for the type userdata as well, otherwise you will misplace tables as vectors.