lua-users home
lua-l archive

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

hi all,

We can get metamethod in a metatable:

local mt = { __newindex = function() print "here" end}
local t = setmetatable({}, mt) --> here

but if here are no __newindex in mt, lua dont request the metatable of
the metatable:

local mmt = { __newindex = functoin() print "here" end}
mmt.__index = mmt
local mt = setmetatable({}, mmt)
print(mt.__newindex) --> a function
local t = setmetatable({}, mt) --> nothing

it means that, you can not set a metatable to a metatable, to control
its behave.

Is that deliberate? Is there any reason to do that?