-
Notifications
You must be signed in to change notification settings - Fork 39
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Extensible classes support #116
Conversation
If a base class sets this option, will all subclasses be extensible as well? (Just trying to understand what is being added.) |
This is something i'm working on. Extensibility is a class property, so should be enabled in each class individually. |
Yes, I agree. I suppose the better, more precise question is, will subclasses be able to access methods added to one of its base classes (up the hierarchy)? |
I'm assuming these functions all receive a |
Definately, this is just the beginning, a lot more tests are needed down there. |
Another point of clarification. It looks like the answer is "no" but just to confirm: Does this allow you to replace existing functions that were registered on the class? One of the reasons we added the |
I'm thinking this by default should not be allowed (added a check for this here 810813e#diff-a6c1434d943944028ce926611075458078b52d6d2de84188f557c344c3c0fe74R297-R313 which prevents any modification). But i see the use cases in controlled environments (we might have a use for that as well for the reason you mention). One complication for that feature could be allowing still to access the |
Will this also eventually include the ability to create custom subclasses from extensible classes? |
Not sure i would mix luabridge inheritance (that works on top of c++ userdata) with mixed one (a lua table which parent is a c++ userdata), mostly because it will overcomplicate key resolution. But contributions are welcome. I suggest we start a discussion on how we would like this to work. Use composition over inheritance, the world is bad already. |
This is now in LuaBridge3/Tests/Source/ClassTests.cpp Lines 2870 to 2895 in 49ddf4f
I would maybe later enable separate index and newindex metamethods for extensible classes, so to not incur into a performance penalty for classes that are not extensible.
|
…etamethod" This reverts commit 1b1aefe.
This PR aims at allowing C++ binded classes to be extensible from lua: