Hello, Is it possible to return the result of a recursive loop to the handler that called the loop, instead of to the previous instance of the handler itself ? I am not sure the question is accurate, but you can check out what I mean with this example-moviescript.on startMovie myList = [5,6,7] myPropList = createList(myList) put myPropList end on createList oldList, newList if not ilk(newList,#list) then newList = [] end if if oldList.count > 0 then newList.add(oldList[1]) oldList.deleteAt(1) createList(oldList, newList) else propertyList = [#propName:newlist] end if return propertyList end The value that is returned to startMovie is VOID, while I need it to be the constructed propList. If I put a breakpoint on the line "return propertyList", I see what is happening, but how can I pass my return value through this stack ? sincerely,
Erik,
This will not work because the propertyList will never be constructed. The if statement only causes a recurse if oldList.count > 0. The else will never happen. This would however work:
on startMovie
myList = [5,6,7]
myPropList = createList(myList, [])
put myPropList
end
on createList oldList, newList
-- if not ilk(newList,#list) then
-- newList = []
-- end if
if oldList.count > 0 then
newList.add(oldList[1])
oldList.deleteAt(1)
createList(oldList, newList)
end if
if oldList.count = 0 then
propertyList = [#propName:newlist]
end if
return propertyList
end
...although I find the whole construction a little awkward. Why do you want this recursive setup anyway?
HTH
-A.
[To remove yourself from this list, or to change to digest mode, go to http://www.penworks.com/lingo-l.cgi To post messages to the list, email [EMAIL PROTECTED] (Problems, email [EMAIL PROTECTED]). Lingo-L is for learning and helping with programming Lingo. Thanks!]