lua-users home
lua-l archive

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




On Tuesday, July 23, 2013, Rena wrote:

On Jul 22, 2013 9:59 PM, "Miles Bader" <miles@gnu.org> wrote:
> p.s. I _also_ think that a similar model (isfunction(), istable(),
> etc) would be better for general Lua type inquiries than type(); see
> various long past threads on this mailing list... :]
I'd long wished for isindexable() and iscallable(), so that tables, functions, and userdata with the appropriate metamethods can be interchanged. Right now even if I have __call and __index on a userdata, many libraries won't accept it because they check the type explicitly.

I like this too, except that I think that the "is__" functions should all be members of type. 

type.isfloat(x)

It seems that all types should have that interface, if some do, and "type" is the logical spot to put them. 

Continuing the current approach of checking to see if the name of the type is equal to a string has limitations. But, tradition as it is...

-Andrew