[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: [PROPOSAL] more luaL_check* in lauxlib.h (for Lua 5.2)
- From: Alexander Gladysh <agladysh@...>
- Date: Thu, 2 Jun 2011 10:29:34 +0400
On Thu, Jun 2, 2011 at 04:45, Miles Bader <miles@gnu.org> wrote:
> Tomas Guisasola Gorham <tomas@tecgraf.puc-rio.br> 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).
Alexander.