lua-users home
lua-l archive

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

On Thu, Jun 2, 2011 at 04:45, Miles Bader <> wrote:
> Tomas Guisasola Gorham <> writes:

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

You really want to check that getmetatable(x) returns a table.

It may return any value that user set to __metatable field (and also
it may return nil — if value has no metatable).