[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Lua 5.3 work1 Considering math.isinteger or type()
- From: Andrew Starks <andrew.starks@...>
- Date: Tue, 23 Jul 2013 06:47:10 -0500
On Tuesday, July 23, 2013, Rena wrote:
On Jul 22, 2013 9:59 PM, "Miles Bader" <firstname.lastname@example.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.
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...