You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
(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:
doubleval[5] = {1, 2, 3, 4, 5};
JSValuejs_array=JS_NewArray(ctx);
for (inti=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)?