Consolidating array accesses
I'm not sure of the lua syntax but something like

arrayAllFalse=TRUE;
for element in array
  if (element) then 
  arrayAllFalse=FALSE
  end

if (arrayALLFalse) then
    --something
end