[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: "nesting" metatables
- From: Marc Balmer <marc@...>
- Date: Thu, 24 Dec 2015 10:15:56 +0100
The reference manual states under 2.4, Metatables and Metamethods, that the __index field can either be a table or a function and that accessing it can trigger another metamethod.
Is it possible to define a metatable that has a table of functions as the __index element, and then, trigger another metatable when a key is not found up in __index?
(I want Lua to first look for functions, then if there is none, call a catch-all index function)