lua-users home
lua-l archive

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


t={}
setmetatable(t,{})
getmetatable(t).__mode='v'

Does that count as violating the restriction that "you should not change the value of its [the metatable's] field __mode"? This restriction is documented in section 2.9.2, http://www.lua.org/manual/5.0/manual.html#2.9.2 . In other words, if the __mode field does not exist, does creating one count as changing its value. Can you change the value of a non-existant field? Do all fields really exist, it's just that most of them are nil?

Also, "setmetatable(x, y)" appears to evaluate to x. Should this be documented?

David Jones