Yonaba / Lua-Class-System

Lua Class System (LCS) is a small library which offers a clean, minimalistic but powerful API for (Pseudo) Object Oriented programming style using Lua.
http://yonaba.github.com/Lua-Class-System
64 stars 17 forks source link

__index metatable for class methods #13

Open abigpotostew opened 10 years ago

abigpotostew commented 10 years ago

Hi Yonaba, I really like your class system! However, all the LCS methods like extends, is_A, getSubClasses, etc. are put right into the tables for instances of my class. You pollute my instances' tables with LCS library methods instead of tucking them away in the index metatable where I believe they belong. Looking over your code, it looks like you reserve the index table for inheritance. Perhaps there is another solution in which you set __index to a function that accesses the base class as well as LCS methods? I'd love to here you're thoughts on this design decision. Thanks!