I have some code where I am successfully loading and compiling a script. This is working great. Next, though, I want to be able to call a function inside the compiled script. Unfortunately, I don't see any way to make a compiled script invokable.
Compilable compEngine = (Compilable)engine;
compiledScripts.put(filename, compEngine.compile(new InputStreamReader(in)));
compiledScripts.get(filename).eval();
//All works until this point. The compiled script does not seem to be invokable.
Invocable inv = (Invocable) compiledScripts.get(filename);
inv.invokeFunction("onLoad");
Is there a way to do this? If so, how? If not, how much of a performance hit is their generally when not compiling the script?