TooTallNate / ref-struct

Create ABI-compliant "struct" instances on top of Buffers
119 stars 75 forks source link

float ref-array in ref-struct #16

Closed richardpike closed 9 years ago

richardpike commented 9 years ago

Hi I'm trying to create an array of a float variable within a structure:

fFloat = ref.types.float;
FloatArray = ArrayType(fFloat);

sFloatStruct = Struct({
    'floatVar': FloatArray(5)
});

I keep getting:

AssertionError: could not determine a proper "type" from: [0,0,0,0,0] at Object.coerceType

Is it possible to do this?

richardpike commented 9 years ago

I think I've just solved this myself after a more thorough look at your test examples (sorry!)

sFloatStruct = Struct({
'floatVar': ArrayType('float', 5)
});

Is what I'm doing now. It's not giving me any errors, so I'll see what testing brings when I get to it.