Cast PoolByteArray to PoolRealArray?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By gandalf3

I want to get an array of 32 bit floats (a Float32Array in javascript) from JavaScript.eval(). When indexing the PoolByteArray JavaScript.eval() returns, I don’t get floats. Is there a way to cast the PoolyByteArray to a PoolRealArray or something similar?

Thanks!

Does something like

var foo = PoolRealArray(JavaScript.eval())

work? If the floating point number precision is cut off when the data is converted from JavaScript to the engine, there’s not much else that can be done.

Ertain | 2020-05-25 04:29

I got a “no such constructor” error.

gandalf3 | 2020-05-25 22:35

Maybe it’s this one instead?

 var foo = PoolFloatArray(JavaScript.eval())

Ertain | 2020-05-25 23:52