Is there a way to get the class/type name of things like BrickColors, Vector3s, etc.
Reason: I usually put assertions in my functions to check that an arguments that it is called with are valid. For Instances, I can check the ClassName property of it, or use the IsA method, but for other things, I cannot.
Example:
function SetColor (Part, Color)
assert(type(Part) == "userdata" and part:IsA("BasePart), "bad argument #1 to \'SetColor\' (BasePart expected) ") -- This would work
assert(type(Color) == "userdata" and Color:IsA("BrickColor"), "bad argument #2 to \'SetColor\' (expected BrickColor)") -- Does not work as BrickColor does not have the IsA Method
assert(type(Color) == "userdata" and Color.ClassName == "BrickColor", "bad argument #2 to \'SetColor\' (expected BrickColor)") -- Does not work as BrickColor does not have the property ClassName
part.BrickColor = BrickColor
end
This is just an example, and not a real use case.
I know I could use something like
function SetColor (part, Color)
-- assert part is part
local a, b = pcall(function() part.BrickColor = Color end)
if not a then error("bad argument #2 to \'SetColor\' (" .. b:match("([^%(]*)%)$") .. ")") end
end
But it does not seem that efficient.

1 comment
Nevermind: just remembered that Roblox has a function called typeof which does this.