On Sun, Sep 2, 2012 at 5:12 PM, William Adams <william_a_adams@xxxxxxx> wrote: > local function makevec(ct) > local tp = ffi.typeof("struct { int n; int Capacity; $ Data[?]; }", ct); > tp = ffi.metatype(tp, kvec_mt); > return tp; > end I have always used the VLA structure for this type of thing. It maked sense to me - you have something of variable size. But why have you got a makevec and a __new? Cant you pass both type and number to an initializer at the same time? I guess it is less modular, but not sure it matters... When I was experimenting with slice (https://github.com/justincormack/slice) I used a Lua table with metatable, so I could keep the type hanging around for future use (I could have used the data[0] thing but it would fail on a zero length array). Justin