The server side code looks like this:
This works, but I'm unable to persist variables between eval() calls.
User posts var laks = "mat"; Then laks.length;
I would like this to return 3, but I'm getting ReferenceError: "laks" is not defined. It seems the "laks" variable is not around the second time eval() is called.
Makes sense, in a way, but how can I accomplish what I want?
Then it should reuse that engine, and its state. As you can see from the code I've edited it evaluates laks.length just fine in the second call to eval.
Joined: Aug 31, 2009
Rob Prime wrote:Then it should reuse that engine, and its state. As you can see from the code I've edited it evaluates laks.length just fine in the second call to eval.
However, I get a different implementation of the ScriptEngine in my web server environment. Looks like that implementation doesn't keep variables. Have to look into that, I guess.
Thanks for the help, it's good to know I wasn't too far off.