lua-users home
lua-l archive

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


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)