Stephan answered your question already.
If you want to read it twice, then print it. Don't just return it.
function helloWorld()
{
print('line1' + "\n" + 'line2');
}
Alexandre
On Mon, Jan 17, 2011 at 6:36 PM, [email protected] <[email protected]> wrote:
> just
>
> Handle<String> source = String::New(scriptbuffer.c_str());
> Handle<Script> script = Script::Compile(source);
> Handle<Value> result = script->Run();
>
> if i run the helloWorld Function 2 times, i just get "line1 line2"
>
> _best,
>
> T
>
>
>
> On 16 Jan., 17:59, Stephan Beal <[email protected]> wrote:
> > On Sun, Jan 16, 2011 at 4:04 PM, [email protected] <[email protected]>
> wrote:
> > > function helloWorld()
> > > {
> > > return 'line1' + "\n" + 'line2';
> > > }
> >
> > > helloWorld();
> > > helloWorld();
> >
> > > ignore the second HelloWorld function call?? output is only "line1
> > > line2" and not "line1 line2 line1 line2".
> >
> > How are you running the script? The script, as shown above, doesn't
> output
> > anything. It just calculates the string values and returns them. If
> you're
> > using the demo shell, it shows you (if i recall correctly?) the value of
> the
> > last-evaluated expression, which is "line1\nline2".
> >
> > --
> > ----- stephan bealhttp://wanderinghorse.net/home/stephan/
>
> --
> v8-users mailing list
> [email protected]
> http://groups.google.com/group/v8-users
>
--
v8-users mailing list
[email protected]
http://groups.google.com/group/v8-users