lua-users home
lua-l archive

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


On Oct 8, 2012, at 11:05 AM, Thijs Schreijer <thijs@thijsschreijer.nl> wrote:

> Yes, only userdata metatables. Metatables on tables do not necessarily have
> a name registered in the registry. 

Along the same lines, but using module's _NAME:

local function Type( anObject )
  if type( anObject ) == 'table' then
    return anObject._NAME or ( getmetatable( anObject ) or {} )._NAME
  end
    
  return type( anObject )
end