Access to parameterized type

  • From: William Adams <william_a_adams@xxxxxxx>
  • To: "luajit@xxxxxxxxxxxxx" <luajit@xxxxxxxxxxxxx>
  • Date: Sat, 1 Sep 2012 16:49:18 +0000

I have need to access the type of the parameter used to construct a 
parameterized structure:
        local Vector = ffi.typeof("struct { int n; int Capacity; $ *Data; }", 
ct);
Is there any way to get at what 'ct' was from within a metamethod?
I can find out how large it is by doing ffi.sizeof(instance.Data[0])
but, all I get out of ffi.typeof(instance.Data) is "struct 102".
Alternative, could I use "struct 102" in any meaningful way, like 
ffi.new("struct 102", 100);
-- William
=============================== - Shaping clay is easier than digging it out of 
the ground.                                       

Other related posts: