- Fixed a bug in which
static
values which evaluated tofalse
were not available in subclasses (#51, thanks @qaisjp for the patch!) isInstanceOf
does not throw an error any more when its first parameter is a primitive (#55) (This effectively undoes the change introduced in 4.1.0)
- Simplifies implementation of
isInstanceOf
andisSubclassOf
. They will now raise an error if their first parameter (theself
) isn't an instance or a class respectively.
- Unified the method and metamethod lookup into a single algorithm
- Added the capacity of setting up the
__index
metamethod in classes - Removed global
Object
(classes created withclass(<name>)
have no superclass now) - Removed default method
Class:implements(<mixin>)
- Renamed several internal functions
- Changed the way metamethods were handled to fix certain bugs (un-stubbed metamethods could not be inherited)
- Added Lua 5.3 metamethod support (
__band
,__bor
,__bxor
,__shl
,__bnot
)
- Added
__len
,__ipairs
and__pairs
metamethods for Lua 5.2
- Anything that behaves reasonably like a class can be a class (no internal list of classes)
- The
class
global function is now just the return value ofrequire 'middleclass'
. It is a callable table, but works exactly as before. - The global variable
Object
becomesclass.Object
- The global function
instanceOf
becomesclass.Object.isInstanceOf
. Parameter order is reversed. - The global function
subclassOf
becomesclass.Object.static.isSubclassOf
. Parameter order is reversed. - The global function
implements
becomesclass.Object.static.implements
. Parameter order is reversed. - Specs have been translated from telescope to busted
- Static methods are now separated from instance methods
- class.superclass has now become class.super
- It's now possible to do class.subclasses
- middleclass is now a single file; init.lua has dissapeared
- license is changed from BSD to MIT. License included in source FTW