it is for the same reason that you can't do:
a = var foo = 1;
"var foo" is a declaration rather than an expression.
If you want something that returns a value, and declares a variable,
you can do something like:
OscriptInterpreter.eval("var foo = 1; foo;");
the second statement after the ";" is an expression... the eval()
should return the result of the last statement.
-- Rob
On Sep 6, 2005, at 11:49 AM, Sergio Szychowski wrote:
>
> Hi,
>
> in the examples of embedding some things not work, but may wasn't
> errors
>
>
>
> -------------------------------------------------------------------
> Value val = OscriptInterpreter.eval("var foo = 1;", a);
> System.out.println("val= " + val );
> //this example returns NULL, when you done
> OscriptInterpreter.eval("var ...") always returns NULL
>
>
> val = OscriptInterpreter.eval("foo = 1 + 4;", a);
> System.out.println("val= " + val );
> //here returns val= 5
>
>
> -------------------------------------------------------------------
>
>
> Greetings.
>
>
> -------------------------------------------------------
> SF.Net email is Sponsored by the Better Software Conference & EXPO
> September 19-22, 2005 * San Francisco, CA * Development Lifecycle
> Practices
> Agile & Plan-Driven Development * Managing Projects & Teams *
> Testing & QA
> Security * Process Improvement & Measurement * http://www.sqe.com/
> bsce5sf
> _______________________________________________
> Objectscript-users mailing list
> Obj...@li...
> https://lists.sourceforge.net/lists/listinfo/objectscript-users
>
____________________
CONTACT INFORMATION:
email: ro...@ti...
IM: rob@sandjabber
desk: 1 858 552 2946
cell: 1 619 300 9661
|