Class++ | Classes and OOP made easy and powerful with Access Specifiers, function overloading and more!

Fixed some problems with the documentation and Wally, you should now be able to easily integrate Class++ with Wally and Rojo!

Also added a new link button on the main post for Wally.

2 Likes

Does this API use metatables? If no at all, then this is great since metatables cannot be transferred between non-module scripts as well as between client and server

Sorry, this API uses metatables. It has to because many features including Operator Overloading and Function Overloading needs to use metatables in order to function.

Though I understand your concern about metatables not being transferred over with RemoteEvents and RemoteFunctions to the Server or the Client, there are solutions such as a constructor that takes in a data table and recreates the object on the Server or the Client.

Generally OOP itself on Luau requires the usage of metatables, without them you lose a lot of power. This API functions almost the same as the Roblox Instance API, both create userdata objects with a metatable attached to them.

I hope this answers your question! If you have more, feel free to ask!

1 Like

Oh, that’s actually sad. Although, the API looks really good. I should use it in my project, probably. Thank you for answer!

1 Like

No problem! Metatables aren’t that bad actually, aside from the issue you mentioned above, the module is very well optimized! (In fact a version for the new type solver is in the works and will be released soon.)

1 Like

will the syntax be changed when the new type solver is implemented?

And how does the constructor and destructor work? when you inherit a class?

does the base class calls the constructor then the derived class’s constructor? or the derived class’s constructor is only going to be called? or which ever is which.

Not at all. The new solver is going to be implemented internally for the purpose of providing a better auto-type completion system for objects. Right now, it is enough for the most part, however, I want to make it so much better, and faster.

Currently, only the derived class’s constructor is called when you create a new object. This behavior will be changed with the new update to behave more like C++'s constructors.
(Parent class’s constructor is called first, then the child class constructor will be called next.)

Hopefully the update is sooner!

I’ve been trying figure out why the constructor does not work as I expected it to be, It does call the constructor on the base class before the derived class but the function does not point any references to self on the base class and only on the derived class.

I was porting some of my Classes to Class++. Unfortunately this is not going to work.

Thanks for the info.

Hmm… that might be a bug, can you create a bug report on the GitHub so I can get it solved ASAP? Sorry about the issue by the way. (You can also post the code you’re having trouble with as well.)

Alright, turns out that was a bug and not intentional (base class’s constructor shouldn’t be called).
In the next update, the base class’s constructor will be called without problems, and bugs should be fixed.

1 Like

I was wondreing about this API and came up with an idea. Why wouldn’t you add a function to transfer an object or class to the different side (client->server\server->client)? This would be such a great feature that will save some time and prevent people from re-inventing the wheel

It’s pretty easy to sync the classes between different environments, an example would be is to create a module that creates a class inside it that can be required from both server and the client, and that class would have a function that takes in the data from different environments and creates an object through this data. All you would have to do is to setup the server-client connection through scripts.

But still, if you implement this feature in your module, this would be a nice bonus

I can’t really implement it to this module, but maybe in the future I can put a small template system inside the GitHub repo to make people’s lives easier.

Sad. But thanks for the answer, although

1 Like

Release 1.2.0


  • class.Inherits and class.Friends properties no longer store classes in a Dictionary. They’re now stored in an Array.
  • Constructors in inherited classes will now call the base class’s constructor first. Then the derived class’s constructor will be called next.
    • This is to match how C++ handles constructors.
  • The classMemberNotFound error will no longer stop the running thread. (NonFatal)
  • In the Error API, logErrorNonFatal method will now correctly display the stack trace.
  • Bug fixes and performance improvements.

(@Neuroticxs try this update and let me know if it fixes your problem.)

1 Like

I’ve made a bug report on GItHub about inheritance. Could you check it, please? In a nutshell, parent class constructor can’t modify private and protected fields when called in inherited class

U. P. D.: The issue was in edited version of the API. Sorry, my bad

Woah! Just stumbled upon this and made me remember one of my (forgotten) resources!

Upon checking the code, primarily Util, looks quite similar to the starting functions of mine. To no assumption would I be saying anything ill regarding about this though! I highly appreciate on how this is a much more superb, flexible, and expanded version of mine! :slight_smile:

Continue on what you’re doing with this, I’d love to see what more features you can add!!

(I’m quite curious if you took inspiration from mine. :sweat_smile:)

Actually, yeah! I got inspired from you a lot in this project, especially the way you used the debug library to obtain information about the stack trace, though I heavily modified the method you used to have high performance (1µs) and more capability.
I forgot to credit you though, so, in a next version, I will credit you in the Util module.

1 Like

I replied to your issue on GitHub.

1 Like