rawget() & metamethods
[
Date Prev][
Date Next][
Thread Prev][
Thread Next]
[
Date Index]
[
Thread Index]
- Subject: rawget() & metamethods
- From: PA <petite.abeille@...>
- Date: 2005年8月10日 22:30:50 +0200
Hello,
Using Lua 5.1 (work6).
I'm trying to list all the functions directly attached to a table using
the following code snippet:
for aKey, aValue in pairs( aTable ) do
if type( rawget( aTable, aKey ) ) == "function" then
print( aKey )
end
end
Works quite alright, except that this also lists all the metamethods
defined by the table parent metatable (e.g. '__eq', '__tostring', etc)
even though those (meta)methods are not directly defined in the table
being enumerated.
Shouldn't rawget() _only_ return values which are effectively defined
by a table, metatable and metamethods notwithstanding?
What gives?
TIA!
Cheers
--
PA, Onnay Equitursay
http://alt.textdrive.com/