lua-users home
lua-l archive

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

Tomas Guisasola Gorham <> writes:
> 	I think there is no efficient way to check if a given object
> is callable.  I would say that one should protect-call it and check if
> it throws an error.  Thus you'd better not check it :-)

isn't it just

function callable (x)
  return type(x) == 'function' or getmetatable(x).__call



One of the lessons of history is that nothing is often a good thing to
do, and always a clever thing to say.  -- Will Durant