lua-users home
lua-l archive

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


Francesco Abbate wrote:
> I was thinking that may be a function ffi.ctype could make the affair.
> The function should return a string that identify the C type of the
> object.

Generating the textual representation of a C type is rather
expensive. Also, it wouldn't really be useful for anonymous
structs (you get e.g. "struct 95", but the number varies).

> Otherwise, am I missing something obvious to obtain the informations
> that I need ?

Yes, I acknowledge there's a need for this. But I'm not sure of
the best way to achieve this. Something like an ffi.isctype()
function. Or maybe an equality operator for ctype objects (but
that has other implications).

Not sure this covers all use cases. Other languages offer subclass
checks or compatibility checks (e.g. to handle pointer compat. or
the pointer/struct duality). But I fear this might add too much
complexity. I'd prefer a simpler solution, if anyone knows of one.

--Mike