lua-users home
lua-l archive

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


> Have you considered the idea recently discussed on this list of having
> some type predicates which could used instead of "type(...) = ..."
> (given that the latter is often flaky and the wrong thing in the
> presence of metatables).
> 
> E.g., callable(...), indexable(...) etc.
> 
> Maybe a single general predicate would work, e.g., something like
> "applicable (OBJ, KEY)" where KEY is the assocated metamethod ('__call',
> '__index', etc).

We are considering this, but only for C (probably in the auxlib). I
guess in Lua most programs simply do the call, without any checks. (This
approach would be another option for C.)

-- Roberto