How do I use the condition "on each" which arrays have?
I want to search and find an emptly "slot" if available, and it seems this condition would be it. But how? There is no info in the help files (or I am looking in the wrong place).![]()
How do I use the condition "on each" which arrays have?
I want to search and find an emptly "slot" if available, and it seems this condition would be it. But how? There is no info in the help files (or I am looking in the wrong place).![]()
The 'on each' condition is for the regular 'for each' loop, i.e. If you have multiple array objects and you wanted to loop through each instance of array objects themself and scope them individually
A regular fast loop should let you loop through an array, then you can stop the loop when it finds an empty slot. Something like this might be what you're after:
![]()
I have tested the loop solution but am still doing something wrong because I can not "catch" which loop the loop stopped at. I need the number so I can place object at the correct place and save to that slot in the array.
Tried so far.
1. Added it to my own project with the condition but could not retrieve the loop number.
2. Made a new test app where I did it exactly as your example but still no go.
3. Tested with no condition and then I would get the end loop number. So at least the loop is looping.
Here is the test app. Load slots in the array with the button first to fill slots. Slot #3 is 0.
Ah, sorry I assumed index 0 for the array and not index 1 - the loop would have been terminating early since it was trying to find a value that didn't exist and would return 0
changing every instance of 'loopindex("check_empty")' to 'loopindex("check_empty")+1' should fix it
Test_loop2.mfa
(I had to remove the binary data for it to work on my computer since I didn't have the local file)