lua-users home
lua-l archive

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


On Thu, Feb 5, 2009 at 11:32 AM, Mark Hamburg <mark@grubmah.com> wrote:
>  Or we need a way to test for
> the presence of the metamethod as well.
>

I would find this useful as well. I use routines like IsCallable() all
over the place,
but in the presence of __metatable (and mindful that the debug library might not
be present), I've written them in C. This is the one obstacle to making some of
our utilities pure Lua.

Something that merely reports presence, without exposing what's underneath,
would be great, e.g.

   function IsCallable (object)
      return type(object) == "function" or hasmeta(object, "__call")
   end