|
Am 23.10.2014 um 10:41 schröbte Procházka Lukáš Ing. - Pontex s. r. o.:
Hello,
Hi!
---- local mt = { __index = {}, } local mt2 = { __index = function(ttt, k) print("mt2", ttt, k) end -- [1] } setmetatable(mt.__index, mt2) local t = setmetatable({}, mt) ---- So, question: how to (anyhow) pass the table 't' to the function [1] so that be able to access 't' members?
I can think of two ways: 1.) Forget about `mt` and make `mt2` the metatable of `t`.2.) Make function [1] a closure referencing `t` (but you will need to duplicate `mt`, `mt.__index`, `mt2`, and `mt2.__index` for every new table like `t`).
To give you more useful answers, I need to know what you are trying to do ...
Best regards, Lukas
Philipp