1
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?

4
  • 4
    You should replace = with ==, but other than that it looks just fine. Commented Dec 18, 2016 at 17:37
  • Thanks! I figured that out and came back here to share that. Commented Dec 18, 2016 at 19:28
  • Now do I mark Joe as the right answer and mark this closed? Commented Dec 18, 2016 at 19:29
  • 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). Commented Dec 19, 2016 at 19:09

1 Answer 1

0

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

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.