参考《Getting started with embedding V8 · V8》
Accessing dynamic variables
首先,创建Point类
class Point
{
public:
Point( int x, int y ) : x_( x ), y_( y ) { }
int x_, y_;
};
其次,编写Point类的创建函数:
// point constructor
void PointConstructor( const v8::FunctionCallbackInfo<v8::Value>& info ) {
v8::Handle<v8::Object> object = info.This();
v8::HandleScope handle_scope( info.GetIsolate() );
int x = info[0]->Int32Value( info.GetIsolate()->GetCurrentContext() ).ToChecked();
int y = info[1]->Int32Value( info.GetIsolate()->