lua-users home
lua-l archive

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


Michal,
were you able to make FFI introspection work the way you wanted? If
yes, could you, please, provide the latest version of the patch you
posted to the Lua mailing list back in February 2011.

Thanks,
--Leo--


On Fri, Feb 18, 2011 at 18:26, Michal Kottman <k0mpjut0r@gmail.com> wrote:
> On 18 February 2011 23:49, Mike Pall <mikelu-1102@mike.de> wrote:
>> Michal Kottman wrote:
>>> I'm trying to add some kind of introspection to LuaJIT FFI, that will
>>> allow to determine not only the type of a cdata object, but also list
>>> it's fields.
>>
>> Wouldn't it be easier to copy the data structure declarations from
>> lj_ctype.h, export the root of the type tree and then use Lua code
>> and the FFI to do the introspection?
>
> Hmm, use the FFI to inspect itself? I am starting to like the FFI so much more:)
>
>>> When looking at ct->info, it is CT_PTR. How can I get to the
>>> structure this pointer refers to? I've tried using ct =
>>> ctype_child(cts, ct), but it fails later on setstrV() with assertion
>>> error.
>>
>> if (ctype_isptr(ct->info)) ct = ctype_rawchild(cts, ct);
>
> Thanks, that solved it! :)
>
>