I found out how to call a function with arguments.
int argc = 1;
v8::Handle<v8::Value> argv[] = { v8::String::New("arg") };
v8::Local<v8::Value> result = function->Call(foo, argc, argv);
But I would like to call a function without any argument, therefore argc
must be 0
and argv
must be an array of zero length, which isn't possible in C++ I guess.
How to properly call a JavaScript function without arguments in V8?
It's very easy, just use:
function->Call(function, 0, NULL);