我正在将google v8嵌入到我的C++程序中。我想获得作为参数传入我的C++函数中的Javascript函数的源代码。比如说,在这里,"L8.function "是指 "L8.function"。
function ComputePixel(nir, red, blue) {
return (nir-red)/(blue-red)
}
var layer = L8.function(ComputePixel, {
‘nir': L8.select('B5'),
‘red': L8.select('B4'),
‘blue': L8.select('B2’) })
这里 "L8.function "是我的C++回调函数。有什么方法可以让我在我的C++函数中得到ComputePixel的完整源代码吗?
你应该可以对它调用ToString。
v8::String::Utf8Value str(args[0]->ToString());