[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: FFI metamethods on C struct pointer
- From: Javier Guerra Giraldez <javier@...>
- Date: Sat, 11 Jun 2011 08:09:14 -0500
I'm blocked, and working late night doesn't help....
i have a C library that defines a struct, with constructor functions
that return pointers to newly allocated structs, and other method
functions that take a pointer to the struct as the first parameter. a
very common C API style.
to access using LuaJIT's FFI, i define a metatype on the struct, but
when i get a ctype with the struct pointer from C, it doesn't seem to
be associated with the metamethods. I've tried dereferencing the
pointer i get, or doing an ffi.cast() to the same struct pointer, and
several combinations of cast+dereference, but just don't get it.
am i missing something obvious?