On Sun, Apr 17, 2011 at 2:51 PM, Chinnu <[email protected]> wrote:
> One final question - now that I've captured the string being passed to > eval, what would be the right Handle<Value> to return from the > function template to keep the script running in V8. >From what i understand, as long as you return any non-empty handle, v8 is happy. e.g. return v8::Undefined() if you don't care about the return value. That's semantically equivalent to returning void in C/C++. > Should I get the > inbuilt eval function handle and pass this arg to that function. > i don't think that will work in your case because you're overriding "eval". That means that fetching the global eval using the code i showed before would return your copy of eval, which (when you forward the argument to it) would result in an endless loop. If your version of evai has a different name, you can forward all of the Arguments values to the global eval using something like: // Copy Arguments data to an array: std::vector< Handle<Value> > vec( static_cast<size_t>( args.Length() ), v8::Undefined() ); for( int i = 0; i < args.Length(); ++i ) vec[i] = args[i]; // Pass them on to the "real" eval() function: theRealEvalFunctionHandle->Call( args.This(), &vec[0], args.Length() ); -- ----- stephan beal http://wanderinghorse.net/home/stephan/ -- v8-users mailing list [email protected] http://groups.google.com/group/v8-users
