RE: Access to parameterized type

  • From: Justin Cormack <justin@xxxxxxxxxxxxxxxxxxxxx>
  • To: luajit@xxxxxxxxxxxxx
  • Date: Mon, 3 Sep 2012 09:04:38 +0100

On 2 Sep 2012 19:57, "William Adams" <william_a_adams@xxxxxxx> wrote:
>
> that might work.
>
> At least syntactically it would be the same thing, and I would not litter
the place with proliferating definitions.
>
> I'll take a crack and constructing things that way and see where I get to.
>
> I will be the first to admit this is pure hackery, and if I understood
the implementation of the parameterized types better I might have already
solved this.
>
> -- William

As Mike said you need a type name (string) a ctype or an object of the
type. So a Lua table can store either of these. An ffi object can only
store the third. But it has to be allocated. You could create a C struct
with a single field of the right type (not an array) and pass this to
create the array if you want to avoid Lua tables.

Justin

Other related posts: