ref-array in ref-struct
S0c5 opened this issue · comments
David barinas commented
Hi, I need help,is it possible to use ref-array in an structure ?
Byte = ref.types.uchar;
ByteArray = ArrayType (Byte);
Uint32 = ref.types.uint32;
BlockData = Struct({
BlockIndexInSector: Int32
Data : new ByteArray(16)
})
this code, show error.
AssertionError: could not determine a proper "type" from: [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0] at Object.coerceType (node_modules\ref\lib\ref.js:389:3)
Nathan Rajlich commented
It sure is! Just drop the new
operator and a "type" object will be returned instead of an instance of the byte array. See the tests for some more examples. Cheers!
Nathan Rajlich commented
So you'd want this:
Byte = ref.types.uchar;
ByteArray = ArrayType (Byte);
Uint32 = ref.types.uint32;
BlockData = Struct({
BlockIndexInSector: Int32
Data : ByteArray(16)
})
David barinas commented
Thank u very much :)
i am testing now :)