1
votes
while (cyclesc > 0) and (FC = 1 or FC = 3 or FC = 4) do
  --dostuff
end

Lua 101 or even coding 101 I'm sure so forgive me - what is best way to write this - nested while loops? seems a waste - is there a way to have multiple conditions in one line of a while loop?

1
You should replace = with ==, but other than that it looks just fine. - siffiejoe
Thanks! I figured that out and came back here to share that. - chazcon
Now do I mark Joe as the right answer and mark this closed? - chazcon
There is no answer to this question yet, so you can write and accept your own (it may take a while before you can accept it). - siffiejoe

1 Answers

1
votes

In your example, you've got

while (cyclesc > 0) and (FC = 1 or FC = 3 or FC = 4) do
  --dostuff
end

which almost works, but you've used = instead of ==. = is the variable assignment operator, and == compares two values.

Your code should be

while (cyclesc > 0) and (FC == 1 or FC == 3 or FC == 4) do
  --dostuff
end

Community wiki as this was solved in the comments