[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Lua type names and the __type metafield
- From: Petite Abeille <petite.abeille@...>
- Date: Mon, 8 Oct 2012 20:55:07 +0200
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