lua-users home
lua-l archive

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


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 )

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?



PA, Onnay Equitursay