local myTable = {} -- your table local counter = 0 -- your counter -- create 10 entries, set them all to false for i = 1, 10 do myTable[i] = false end -- checks table values, if they are false increase counter by 1 local function checkEntries() for i = 1, #myTable do if myTable[i] == false then counter = counter + 1 end end end -- run the function checkEntries() -- compare counter to total entries, if equal, it means they were all false, so change them to true if counter == #myTable then for i = 1, #myTable do myTable[i] == true end counter = 0 -- reset the counter to use again end
The same approach can be used to test if all table entries are true, then if they are, run your function.