[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: metatable and Lua numbers
- From: "Leo Razoumov" <slonik.az@...>
- Date: Mon, 28 Aug 2006 12:16:22 -0400
Lua 5.1.1 reference manual as well as PiL2 both claim the same:
"Tables and userdata have individual metatables (although multiple
tables and userdata can share a same table as their metatable); values
of all other types share one single metatable per type. So, there is
one single metatable for all numbers, and for all strings, etc."
(verbatim quote from reference manual, section 2.8 - Metatables).
Contrary to what ref.manual says numbers do *NOT* have any metatable.
On my Lua-5.1.1 (Linux 2.6.13) I get the following:
print( getmetatable( 1)) --> nil
Am I missing anything here?
P.S. Strings do have the same metatable shared among them:
print( getmetatable( ""))
print( getmetatable( "A"))
print( getmetatable( "B"))