lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On Thursday 27 January 2011 05:20:15 steve donovan wrote:
> On Thu, Jan 27, 2011 at 12:13 PM, Axel Kittenberger <axkibe@gmail.com> 
wrote:
> > any content of metatables? My guess that newbies are so freightened
> > from metas is just exactly the __syntax.
> 
> Hm, I don't think newbies should worry themselves about metatables.
> They are a subtle concept and the underscores are the least part.
> 
> Bear in mind that it _is_ common to put things into metatables;
> there's a common OOP pattern that works like this:
> 
> -- define a class
> A = {}
> A.__index = A

Steve, you just lost me. I thought __index is the function that gets done when 
you write-access a key in the table. But A is the whole table, not a function. 
What am I missing?

Thanks

SteveT

Steve Litt
Recession Relief Package
http://www.recession-relief.US
Twitter: http://www.twitter.com/stevelitt