lua-users home
lua-l archive

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

On Dec 17, 2009, at 7:20 AM, steve donovan wrote:

> Yes, so like others, I've written utility functions to detect the
> 'effective' type of an object.  This depends on the OOP style used, so
> it can never be standard.

OOP or not, a module _NAME could be used for such purpose, e.g.:

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