Notifications
Clear all

[Closed] Get Mapped Function Iterative?

Just thought I would try out a mapped function an I am curious, as the docs are pretty slim in this regards sample wise, is it possible to get the iterative that the function is going through, much like the integer count of a for loop? someArray[i]

  for instance:

      mapped fn doSomething obj =
      (
        if (classof obj) != Editable_Poly do convertToPoly(obj)
        ...
        ...
      )
      
      on theButton pressed do doSomething (selection as array)
  Can I get the iteration of the selection being processed by the function? Is it even possible?
2 Replies
 JHN

Just add a counter see what happens, or pass a counter by reference, and add +1 in the function.

mapped fn doSomething obj counter =
        (
          if (classof obj) != Editable_Poly do convertToPoly(obj)
          counter += 1
          ...
          ...
        )
        counter = 0
        on theButton pressed do doSomething (selection as array) &counter
        print counter

Not behind max, so your milage may vary

-Johan

Johan, tried it, works a treat, thanks