New typeof() global function

This function is now live. It allows you to get the type of Roblox types like Vector3 and Ray.

Examples:

print(typeof(Vector3.new())) --> Vector3
print(typeof(Ray.new())) --> Ray
print(typeof(0)) --> number
print(typeof(nil)) --> nil
print(typeof(Instance.new("Part")) --> Instance
89 Likes

I like that it’s called “typeof” instead of “robloxtype” or some other term that was coined in the feature requests, this is nice

3 Likes

This is dope.

2 Likes

This type of feature is great. :ok_hand:

4 Likes

@Sharksie, dreams do come true :’)

5 Likes

My legacy!

1 Like

hasn’t this been live for a bit now? I thought I was using it just a few days ago.

1 Like

Nope, this was turned on today. You might be confusing this with the “type” Lua builtin which has been around forever.

2 Likes

ah, you’re right. :confounded:

1 Like
print(typeof(typeof)) --> Dope

but which thegamer101 made it

6 Likes

Why not just overload type() instead of creating typeof?

1 Like

Backwards compatibility

6 Likes

typeof falls back to type, so you can still get all the basic lua types that type would give you.

1 Like

We can go deeper… which actually prints string.

print(typeof(typeof(typeof)))
3 Likes

I will take credit for the name, glad you like it!

5 Likes

It matches JavaScript so I’m happy too :stuck_out_tongue:

4 Likes
print(typeof(newproxy(true)))

Currently this causes every client to lose connection (when ran server-side).

2 Likes

More generally, typeof(newproxy(true)) always causes a crash. gg.

I’ll make a bug report so someone sees it faster

1 Like

I had to turn this off due to the bug. I will fix the bug as soon as possible and then turn this on again.

1 Like

You can ignore this post if the bug caused issues that affected something outside of just the typeof function, but:

What’s the reasoning behind turning it off due to an obscure bug? newproxy isn’t commonly used in ROBLOX, so only a very narrow margin of cases would have actually been affected by this, if any at all (not counting people who were doing it to test).

What’s the difference from using a piece of code like while true do end compared to this? If they both have the same result (crashing the client or server) and they are both either programmer error or something that would probably never realistically happen, then I don’t see the benefit of turning this off.

A lot of things have bugs when they are released but I don’t think it’s really a good idea to just remove them after announcing them due to an obscure bug. I feel that in this case by removing the function you have probably broken or affected more code than would have been affected if you had just left it in its current state then hotfixed it a few days later.

But that’s just my two cents.

7 Likes