Reputation: 851
I am working on a NodeJS addon project and i couldn't really understand how to pass a long value into my object.
Here is my code:
#include <node.h>
namespace NODEAPP
{
using v8::FunctionCallbackInfo;
using v8::Isolate;
using v8::Local;
using v8::Object;
using v8::String;
using v8::Value;
using v8::Handle;
void fooFunc(const FunctionCallbackInfo<Value>& args)
{
long foo = 51294;
long bar = 91923;
Isolate* isolate = args.GetIsolate();
Local<Object> obj = Object::New(isolate);
obj->Set(String::NewFromUtf8(isolate, "msg"), wanna pass foo here);
args.GetReturnValue().Set(obj);
}
}
Thanks in advance
Upvotes: 0
Views: 102
Reputation: 851
I found out.
Here it is:
obj->Set(String::NewFromUtf8(isolate, "msg"), v8::Integer::New(isolate, foo));
Upvotes: 2