lua-users home
lua-l archive

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


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?

--Leo--

P.S. Strings do have the same metatable shared among them:

print( getmetatable( ""))
table: 0x806afb8
print( getmetatable( "A"))
table: 0x806afb8
print( getmetatable( "B"))
table: 0x806afb8