bitser icon indicating copy to clipboard operation
bitser copied to clipboard

Dealing with cdata VLA

Open sonoro1234 opened this issue 4 years ago • 1 comments

Hi,

VLA cdata makes bitser to error

This script runs ok but uncomenting comented lines (and comenting the two lines below) it will error

local ffi = require"ffi"
local bitser = require"bitser"

--local vecN = ffi.typeof("float[?]")
--local a = vecN(5,{1,2,3,4,5})
local vecN = ffi.typeof("float[5]")
local a = vecN({1,2,3,4,5})

local b = bitser.loads(bitser.dumps(a))

print(a,b,b[0],b[1])

I can propose a PR to fix it if you wish.

sonoro1234 avatar Mar 26 '21 10:03 sonoro1234

If you have the solution, please, be my guest!

gvx avatar Mar 31 '21 05:03 gvx