Middleclass attemps to be a mid-sized library (~120 lines of code, on a single file), with clean, easy to understand code, and yet powerful enough to be used in most cases.
* support for Lua metamethods: just define a method called @__tostring@, @__add@, etc. and your instances will be able to use it.
* Mixins:
** A very simple mechanism for sharing functionality among a group of classes that are otherwise non-related.
** Mixins are just simple lua tables with functions inside them.
** @Class:include(mixin)@ will copy the function definitions of @mixin@ to @class@
** If @mixin@ contains a function, called @included@, that function will be invoked right after the functions have been copied. It allows for modifying the class more profoundly.
* The function @instanceOf(class, instance)@ returns @true@ if @instance@ is an instance of the class @Class@
* The function @subclassOf(Superclass, Class)@ returns @true@ if @Class@ is a subclass of @SuperClass@
* The function @includes(mixin, Class)@ returns @true@ if @Class@ (or one of its superclasses) includes @mixin@.
As an alternative, you can directly download "middleclass.lua":https://github.com/kikito/middleclass/raw/master/middleclass.lua and "BSD-LICENSE.txt":https://github.com/kikito/middleclass/raw/master/BSD-LICENSE.txt and put them in your project.
This library has a companion lib that adds a lot of interesting functionality to your objects. Give it a look at "middleclass-extras":https://github.com/kikito/middleclass-extras