}
private Object callGlobal(String name, Object[] args, ScriptContext ctx) {
Closure closure = globalClosures.get(name);
if (closure != null) {
return closure.call(args);
} else {
// Look for closure valued variable in the
// given ScriptContext. If available, call it.
Object value = ctx.getAttribute(name);
if (value instanceof Closure) {