Commits

Anonymous committed 4ebc314

hello, again

Comments (0)

Files changed (1)

   v0[0]= Integer::New(23);
   //  global->Set("v0", 
   const char* fun = "fun0 = function(i){ return i+1; }";
+  const char* fun1 = "fun1 = function(i){ return i-1; }";
   Local<Value> ret = create_func(global, fun, "fun0");
+  Local<Value> ret1 = create_func(global, fun1, "fun1");
   Persistent<Value> f = Persistent<Value>::New(ret);
+
   Handle<Value> result = ((Function*)(*f))->Call(global, 1, v0);
+  String::AsciiValue ascii(result);
+  printf("%s\n", *ascii);
+
+  Persistent<Value> g = Persistent<Value>::New(ret1);
+  result = ((Function*)(*g))->Call(global, 1, v0);
+  String::AsciiValue ascii1(result);
+  printf("%s\n", *ascii1);
 
   // Run the script to get the result.
   //  Handle<Value> result = script->Run();
   context.Dispose();
 
   // Convert the result to an ASCII string and print it.
-  String::AsciiValue ascii(result);
-  printf("%s\n", *ascii);
   return 0;
 }