(Apologies if a GH issue is the wrong venue for a question like this!)
Currently when using the C API to initialise an Array of scalar values, I have to create a new JSValue for each element and then assign it to the array:
double val[5] = {1, 2, 3, 4, 5};
JSValue js_array = JS_NewArray(ctx);
for (int i = 0; i < 5; i++) {
JS_SetPropertyUint32(ctx, js_array, i, JS_NewNumber(ctx, val[i]));
}
In situations like this where I have a contiguous block of values in memory, is there an API for initialising an Array without having to loop over each element? Is it possible to create a new Array, specify its length, and memcpy the memory over (or similar)?
Thanks!