Re: FFI methods for userdata objects

  • From: Mike Pall <mike-1208@xxxxxxxxxx>
  • To: luajit@xxxxxxxxxxxxx
  • Date: Sat, 25 Aug 2012 13:13:00 +0200

Simon Cooke wrote:
> The simple FFI method call to ud:get() works as expected, but the
> metamethod __call fails.

The __call metamethod must be a plain function, you can't pass
arbitrary callable objects (such as an FFI function). I don't see
an easy way to work around this -- it would require double
dispatching (or many more dispatches in the worst case).

> I encountered similar behaviour with other metamethods, but with
> different errors.

Umm, examples? E.g. __add can certainly be an FFI function.

--Mike

Other related posts: