I am embeding google v8 into my C++ program. I want to get the source code of Javascript functions passed as arguments into my C++ function. For example:
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’) })
Here "L8.function" is my C++ callback function. Is there any way I get can the complete source of ComputePixel in my C++ function?
You should be able to call ToString on it:
v8::String::Utf8Value str(args[0]->ToString());