Basically I want something like this, its written on Sikuli.
Iterator<Match> it = s.findAll(Imagepath);
System.out.println("the match is "+it.next().click());
} Do we have hasNext() function in ankulua?
Here is what I try to write in lua
a = Pattern("image.png"):similar(0.7) b = Pattern("image2.png"):similar(0.7) r = Region(1922, 5, 400, 910)
all = r:findAll(a)
-- I know its not gonna work need advice to write this code in lua
while(all.hasNext()) do --I want to iterate as many as "a" images on "r" click(all) --I want the script to click the first "a" if(notExist(b)) then click(all.next) --This mean, If "b" not exist, i want to click next "a". end end
So.. what I try to achieve here is. 1. I Want to iterate as many as image1 in a region. 2. If dont see image2, I want to check on next image1.
I'm bit new in programming. So I might be screw my logic here. Thank you.