Re: ffi - C array to lua table ?

  • From: Coda Highland <chighland@xxxxxxxxx>
  • To: luajit@xxxxxxxxxxxxx
  • Date: Sat, 11 Jul 2015 12:47:10 -0700

On Sat, Jul 11, 2015 at 12:25 PM, voidptr69@xxxxxxxxxxx
<voidptr69@xxxxxxxxxxx> wrote:

noob question,

in the motivation example we allocate space for a C array with

local img = ffi.new("rgba_pixel[?]", n)

but how can the reverse
transfering my C array of some type (at least int char ... ) into a lua
table

:-)


The real question is: Why do you want to?

This is generally NOT what you really want to do. Performance is
better if you can stick to C structures instead of Lua tables.

So my return question for you is this: What are you trying to
accomplish? What do you want the code to look like when you're using
this data?

/s/ Adam

Other related posts: