[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Question about __index and classes
- From: Michael Kirsch <mkirsch358@...>
- Date: Sat, 27 Aug 2011 18:52:41 -0400
There is something I don't understand about the way __index and
metamethods work. The way I understand, the "." operator looks in the
table itself and the ":" operator looks directly in the metatable. If
so, then why is it necessary to say:
MyClass.__index = MyClass
for you to be able to use ":"?
If ":" looks right in the metatable, then it shouldn't be needed. To
me it seems like what it would do is let you call metamethods using
the "." operator, but it doesn't work that way for some reason.