Thank you Stephan. You are right, the args[0] gives the value I'm interested in. I was playing with a script that has a function call as a parameter to the eval, and for some reason, I thought I was getting a function handle in the args[0] earlier. My mistake, it does give me the result being passed to the eval.
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. Should I get the inbuilt eval function handle and pass this arg to that function. Thank you, Ravi On Apr 17, 8:02 am, Stephan Beal <[email protected]> wrote: > On Sun, Apr 17, 2011 at 1:48 PM, Chinnu <[email protected]> wrote: > > Thank you Stephan, for the clarification. Actually, I'm interested in > > the result of the expression. For instance, in the above example of > > eval('a'+'b'), I'm trying to gather the string 'ab'. I'm wondering on > > how to parse the args for this. > > They don't need to be parsed, as v8 has already processed them. In this > example case, args[0] would return "ab" as a value handle holding a string > value. Or am i misunderstanding your question? > > Note that v8 has a built-in "eval" command, and getting access to it > requires something like this: > > Local<Object> evalObj = v8::Context::GetCurrent()->Global(); > Local<Function> eval = v8::Function::Cast( > *(evalObj->Get(v8::String::New("eval"))) ); > > -- > ----- stephan bealhttp://wanderinghorse.net/home/stephan/ -- v8-users mailing list [email protected] http://groups.google.com/group/v8-users
