Does anybody know the difference between type(v) and typeof(v)?

I want to know whether I should use

type(variable)

or

typeof(variable)
2 Likes

typeof accounts for Roblox DataTypes, while type does not (it only accounts for regular Lua DataTypes and vector):

print(type(CFrame)) --> prints "userdata"
print(typeof(CFrame)) --> prints "CFrame"
1 Like

type() returns the LUA type of an object, being a number, string, variable, table, function, etc…

typeof() returns what type does and as well as the Roblox class name for Roblox specific types.

2 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.