// Start with an array.constsize_t COUNT =3;
VuoReal src[COUNT]={4.0,5.0,6.0};// Create a list containing 3 items each initialized to 0.
VuoList_VuoReal list = VuoListCreateWithCount_VuoReal(COUNT,0.0);// Get a pointer to the array containing the list items.
VuoReal *dst = VuoListGetData_VuoReal(list);// Copy the contents of your array into the list's array.memcpy(dst, src, COUNT *sizeof(VuoReal));
Or this would be more concise though less flexible (e.g. wouldn't handle variables as list items):
// Start with the items in a JSON-formatted string.constchar*src ="[4.0, 5.0, 6.0]";// Create a JSON object from the string.
json_object *js = json_tokener_parse(src);// Create a list from the JSON object.
VuoList_VuoReal list = VuoList_VuoReal_makeFromJson(js);// Release the JSON object so it gets deallocated.
json_object_put(js);
// Start with an array.constsize_t COUNT =3;
VuoReal src[COUNT]={4.0,5.0,6.0};// Create a list from the array.
VuoList_VuoReal list = VuoListCreateWithValueArray_VuoReal(src, COUNT);
Comments
Well, not really. You could
Well, not really. You could do:
Or this would be more concise though less flexible (e.g. wouldn't handle variables as list items):
Or, as of Vuo 2.4.1:
Or, as of Vuo 2.4.1: