[prev in list] [next in list] [prev in thread] [next in thread] 

List:       bsf-discussion
Subject:    Re: [bsf-discussion] Calling a  function from Java
From:       Norris Boyd <nboyd () atg ! com>
Date:       2001-02-28 20:20:39
[Download RAW message or body]

I think a previous eval() call should be called on a script that contains
functions you might want to call. The effect of eval'ing a function
definition is to define the function in the scope. You don't have to parse
out the function body.

- --N

Jeff Tollefson wrote:

> >From the documentation:
> "
> 4. (Optionally) Load any scripting engines that you want:
>         BSFEngine rhinoEngine = mgr.loadScriptingEngine ("javascript");
> Now you're ready to call functions in the script or to evaluate/execute
> arbitrary scripts:
>         Object result = rhinoEngine.eval ("testString", 0, 0, "2+32");
>         result = rhinoEngine.call (null, "hello", null);
>         rhinoEngine.exec ("testString2", 0, 0, "hello ()");
> "
>
> I think that I'm missing a step here... Where do we point to a
> particular script (in this case the let's say the script is
> TestScript.js).  I can 'eval' the function if I read in TestScript.js
> and parse out the function myself, but I thought that is what '.call'
> was for.
>
> Can someone please supply a working example of calling a function or
> method.
>
> Thanks
>
> ----
> To get off the bsf-discussion list, send a message containing the word
> "unsubscribe" (in the body, not the subject) to
> <bsf-discussion-Request@OSS.Software.IBM.Com>.
>
> Send Majordomo commands to: <bsf-discussion-Request@OSS.Software.IBM.Com>
> To contact a human:         <bsf-discussion-Owner@OSS.Software.IBM.Com>
> To post to the list:        <bsf-discussion@OSS.Software.IBM.Com>


- ----
To get off the bsf-discussion list, send a message containing the word
"unsubscribe" (in the body, not the subject) to
<bsf-discussion-Request@OSS.Software.IBM.Com>.

Send Majordomo commands to: <bsf-discussion-Request@OSS.Software.IBM.Com>
To contact a human:         <bsf-discussion-Owner@OSS.Software.IBM.Com>
To post to the list:        <bsf-discussion@OSS.Software.IBM.Com>
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic