Take a look at a class module on github called “MiddleClass” literally converting that or upgrading it to your liking would be the Boss mode. It is by far the best Class module I have ever worked with in Lua.
All my suggestions would be to make it behave more like middle class, but again I am biased because to date I have not found a better class module period.
Just something to bare in mind for anyone looking at this and considering “type” strictness in your coding. For lua, adding type strictness has three main bonuses.
-
More implicit explanation of variable types so documentation can be sparcer if you are doing everything else right.
-
It can help with error checking
-
Fancy Auto complete
The biggest Con atm is it adds a lot of visible jargon that takes awhile to get used too and understand. Currently Typed lua is a transpiled language so there is zero benefit to speed or performance by being typed.
Fundamentally, if you are doing strong formatting of your code, naming your variables well, and having a system for tagging their types, your already doing it. Technically.
That being said, it may make moving from one language to another easier if you are already quite comfortable with it, but I highly suggest not getting too caught up in needing typed code. IMO I would consider it as something should do as your clean up pass on a system of code but not when you are writing a new system first pass.
There may be some tricks it can do that I would have to drill into more, but I am a bit noob at some of the really advanced trickery of typed, but from what I have read a lot of that this pretty obscure.
All that being said, I have not looked at the module directly yet, but are you tracking your objects types as they are created to mitigate conflicting Types, are you offering any sort of way of storing creating objects to be cleaned up.
How would this look if you created Person in one module, and then wanted to extend in another module. What does the syntax do then?