[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Setting the __mode metatable field
- From: David Jones <drj@...>
- Date: Tue, 4 Jan 2005 12:05:36 +0000
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