[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: [manual] chaining metamethods
- From: Dirk Laurie <dirk.laurie@...>
- Date: Wed, 27 Jan 2016 20:27:08 +0200
2016-01-27 19:04 GMT+02:00 Stephan Hennig <email@example.com>:
> Note that queries for metamethods are always raw; when
> looking-up metamethods, Lua doesn't consider a metatable's
> metatable. Lua considers metatables of metamethods, though.
> In fact, chaining metamethods is at the heart of many
> approaches to object-oriented programming in Lua.
Sorry, I find this more obscure than the original one-sentence
> Note that queries for metamethods are always raw; the access
> to a metamethod does not invoke other metamethods.
I read this as "if the metatable does not contain for example
__add, the __index metamethod is not invoked to find
a fallback, eic." What other way is there of reading it?