[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: question about cdata type identification
- From: Francesco Abbate <francesco.bbt@...>
- Date: Mon, 18 Apr 2011 10:47:29 +0200
Hi Geoff,
I was thinking to this solution, among the others, but 'getmetatable'
on a cdata return the string 'ffi' and not the real metatable :-) I
believe this is because LuaJIT is implementing a specialized lookup
mechanism for cdata.
For the other side you could implement a method called, let say,
'ctype' that return its ctype as a string. Since you can define the
__index metamethods this is rechnically possible. The problem is in
this case that if I call x.ctype() when x is another cdata which is
not aware of this convention an error can be raised. Of course you can
catch the error but the function would begin to look seriously
over-complicated.
This is the reasoning that let me think that a basic ffi function was
may be needed.
Francesco