Say I have an array with values of any type in it (well, a limited subset. No strings. Nor any nesting with other arrays or dicts), and yes, they can be mixed ([42, 3.14]).
How would I create a PackedByteArray from this array? Specifically such that it follows the same rules as the Packed*Array ones (like how PackedInt32Array gives each int 4 bytes, and has no delimiting bytes), resulting in similar bytes?
I have tried using var_to_bytes by mapping var_to_bytes(v).slice(4) over the array. But the issue is that it uses 64 bits for some types (i.e floats) - likely because I got a 64-bit system.
But I need it to be fooled into thinking I have a 32-bit system during the conversion, as the array I produce need to have 4 bytes for floats (and 8 for doubles). This is because I will be using it to create a buffer using RenderingDevice, to send the data to shaders (where float is 4 bytes, and doubles are 8).
I considered making my own serializing method/class, but I absolutely do not want to do that, for something that is obviously going to have some simply std-way to do it.