Skip to content Skip to sidebar Skip to footer

Access Local Variable From Outside The Function

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 ori

Solution 1:

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;
},

Solution 2:

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).

Post a Comment for "Access Local Variable From Outside The Function"