What does type and typeof mean?

Hi firstly happy easter :hatching_chick:

Right so I came across somthing called type and typeof in one of @NWSpacek scripts Ive been looking for what it does and I have found nothing can you help?

type and typeof basically just returns the type of something

local text = "Test"
print(type(text)) -- prints "string"
print(typeof(text)) -- also prints "string"

The only real difference between them is that typeof has more accuracy when trying to get the type of one of Roblox’s types, such as Vector3, as if you use type on a Vector3, it would return userdata I believe, whereas if you used typeof, it would return Vector3

Here are some pictures from the official roblox dev wiki that explain them


typeof, taken from Roblox-Globals

type, taken from Lua-Globals

8 Likes

@EmbatTheHybrid ive also seen somthing like this before

type.WhatisThis()

I think It was like that anyway

I think that looks like something related to a modulescript being required with the variable name of type, I don’t believe you can do that with the default type and typeof

ill try find the script I found it in

Anouther thing ive come accross is self what does this mean?

I would recommend reading up on this to help you understand it