4
A
回答
7
直接来自Embedder's Guide的此示例看起来非常接近您想要的 - 用新的String
对象替换新的Integer
对象。
// This function returns a new array with three elements, x, y, and z.
Handle<Array> NewPointArray(int x, int y, int z) {
// We will be creating temporary handles so we use a handle scope.
HandleScope handle_scope;
// Create a new empty array.
Handle<Array> array = Array::New(3);
// Return an empty result if there was an error creating the array.
if (array.IsEmpty())
return Handle<Array>();
// Fill out the values
array->Set(0, Integer::New(x));
array->Set(1, Integer::New(y));
array->Set(2, Integer::New(z));
// Return the value through Close.
return handle_scope.Close(array);
}
我读了关于Local和Persistent句柄的语义,因为我认为那是你卡住的地方。
这条线:
v8::Handle<v8::Array> result;
不创建一个新的阵列 - 这只会造成以后可以用数组填充句柄。
相关问题
- 1. jquery如何填充数组
- 2. 填充数组
- 3. 填充数组
- 4. 填充数组
- 5. 如何在scipy.fftpack中为二维数组填充零填充?
- 6. 如何填充这些数组以填充tableView?
- 7. 猫鼬填充不填充数组
- 8. VB.Net - 填充数组
- 9. 填充Java数组
- 10. 填充numpy数组
- 11. 填充3D数组
- 12. 如何填充组合框?
- 13. 如何用给定值填充数组
- 14. RegExp.exec如何填充其结果数组
- 15. scala 2.11.8如何填充数组
- 16. 如何填充空字符数组?
- 17. 我该如何填充数组
- 18. 如何填充MyObjects的数组PHP
- 19. 如何正确填充顶点数组
- 20. 如何用假期填充数组?
- 21. 如何用对象数组填充TableView?
- 22. Bash脚本 - 如何填充数组?
- 23. 如何填充ComboBox的数组?
- 24. 如何填充不同值的数组
- 25. 如何填充unique_ptr的数组?
- 26. HorizontalListView如何填充图像数组?
- 27. 如何用urls数组填充UIImageView?
- 28. 如何从JavaScript数组填充div-table?
- 29. 如何用ajax填充数组?
- 30. python如何用零填充numpy数组
Array :: New现在需要传入隔离指针作为第一个参数:Isolate * isolate = args.GetIsolate();处理 array = Array :: New(isolate,3); –
HeadCode
如何创建这种类型的二维数组?像这样的东西v8 ::本地结果=新(v.size()); 但是2d? –