Re: ffi - C array to lua table ?

  • From: "voidptr69@xxxxxxxxxxx" <voidptr69@xxxxxxxxxxx>
  • To: luajit@xxxxxxxxxxxxx
  • Date: Sat, 11 Jul 2015 15:47:31 -0400

Well I meant more strait forward than:

a = {0,1,2.3}
local vla = ffi.new("int[?]", #a, unpack(a))
i = lib.arr1(#a, vla)

local t = {}
for i = 0, #a-1 do
t[#t+1] = vla[i]
end

:-)

On 2015-07-11 3:25 PM, 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

:-)

Other related posts: