I'm trying to use Beanshell in a java application to execute "addon" files supplied by a user. Since the "main" code of the addon is called in a repeating loop, some addons need to use global variables initialized outside the scope of this code in order to keep track of things that require more than one loop cycle. I'm trying to do this by setting up a beanshell interpreter as
interpreter.eval("float xPositions;");
while(condition) {
interpreter.eval("xpositions++;");
}
The problem is, by the time beanshell gets the second eval, it's forgotten that the variable exists. Is there a way to stop it doing this?