View Single Post
Oh, just realised it needs to be a property since it's a list of all nodes seen so far (to avoid cross links revisiting), not just nodes seen in this particular calling of the function, and thus needs to store values across multiple calls and recursive calls.

So, example code might be

Code:
on run
  tell application id "OGfl"
    tell front window
      set theSelection to the selection
      if theSelection is not {} then
        set plstSeen to {} -- initialise for a new tree
        set theResult to my GetChildren(item 1 of theSelection, 2)
      end if
    end tell
  end tell
end run

property plstSeen : {} -- persistent storage of seen nodes
on GetChildren(oParent, iAxis)
  -- etc
end GetChildren