views:

35

answers:

2

I'm using TopUp to make a simple slideshow. Unfortunately they don't expose the image index.

Is there a way I can access the local variable "index" without having to modify the original script?

TopUp = (function() {
 var index = null;
    ...
}
A: 

There's no way to get that variable out. Looking at the (somewhat scary) source, It doesn't look like the "ondisplay" callback is passed anything useful, but it's not really clear (and the documentation doesn't mention the parameters at all).

Pointy
+1  A: 

Without modifying the original script, you can't.

But if you just want to be able to read the value of index, the modification could be really simple, by adding a little function in the objet returned :

getIndex : function() {
  return index;
},
Golmote