Classes for luau module

typeof(if type(class) == "string" then nil else class) doesn’t work for some reason

class.rbxm (1.8 KB)

Guys new update now there is autocompletion for classes and stuff

My apologies, the thing I was talking about had been brought down before.

archived comment

Just noticed in the code that you used the functions “getfenv” and “setfenv” which is deprecated and disables a Luau optimization.

I would recommend that you pass the this object to the first argument of constructor and the new function constructor should get the class name from the first passed argument. Only problem is that you will need to cache created class constructors (I know you are already doing that on the global environment.) or just ditch the class "Clazz" {} in exchange of local Clazz = class {} and add the new function on created class constructor