kikito / middleclass

Object-orientation for Lua
https://github.com/kikito/middleclass
MIT License
1.77k stars 190 forks source link

__index functions for classes #2

Closed TheLinx closed 14 years ago

TheLinx commented 14 years ago

I'd love to be able to write an __index function for classes, and it would be called when the requested instance method can't be found in the subclass.

kikito commented 14 years ago

:) I've thought about that quite a lot. Superclasses complicate it a bit.

I'll give it a try right after finishing with the init.lua fix

TheLinx commented 14 years ago

Awesome, thanks

kikito commented 14 years ago

I've created a fix for this, but I've moved it to middleclass-extras for performance reasons. In order to get __index capabilities, you have to use https://github.com/kikito/middleclass-specs/blob/master/extras_Indexable.lua now.