OOP inheritance in Lua (Feedback)

I saw a lot of discussion in threads about making lua “classes” inherit one another. I thought I could try to make a module to implement basic single inheritance. This is my module in a repo on GitHub:

if anyone is more knowledgeable on how Lua handles memory I’d love any feedback on how this can be improved. I am not entirely sure how Lua handles pointers and whatnot, so if my module has some sort of bug related to that, or anything performance-wise that can be improved, I would appreciate hearing what you think. I used this module already, and it seems to be working as intended, please let me know of any bugs you encounter, or if the module is not working as intended in your game.
Thank you!

(Side note: if this is working without any memory no-nos and people like this, I will try to implement multiple inheritance in a later commit!)

3 Likes

I saw the source code and I noticed that the inheritance only applies to functions. Inheritance doesn’t only apply to functions. It also applies to properties and events. Line 32 should be if inheritance[i] ~= false then.

Other than that, the module is good.

3 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.