lua-users home
lua-l archive

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


Javier Guerra Giraldez wrote:
> 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?

Well, that should work just fine. How did you define the struct?
You realize that each "struct {...}" defines a _unique_ struct,
even if it has the same members? Better use a named struct or a
typedef everywhere.

Maybe posting a simplified excerpt of your code would help.
Quite often the problem is solved during that process. :-)

--Mike