Subj : Re: [spidermonkey]How to: get another variable values from JS? To : netscape.public.mozilla.jseng From : laser Date : Thu Jun 30 2005 08:01 pm I have get the values of varible "ln"!! Thank you very much. Brendan Eich wrote: > laser wrote: > > > I also have another question, when I use spidermonkey to excute JS > > like: > > > > var ln = 5; > > var ln1; > > ln1 = ln*2; > > > > I can get the values of variable ln1 by using API JS_EvaluateScript and > > JSVAL_TO_INT, but how can I get the values of variable ln? > > > The value of a script is the value of the last expression statement > evaluated in it. That may be what you mean by "get the value of ln1" > (the *rval out parameter of JS_EvaluateScript, for this script). To get > ln, you could call JS_GetProperty(cx, global "ln", &v). > > /be .