1. When in doubt; use parantesis:
Code:
IF a and b or c and not d...
IF (a and b) or (c and (not d))...
IF (a) and (b) or (c) and (not d)...
2. You can always use nesting of IF's.
Code:
IF a and b
IF c
...
ElseIF not d
...
end
end
My main thing is always to make the code readable and understandable for yourself (and others). Imagine coming back to the code 6 months from now when you dont remember anything about why it's there. Making it super-condenced most of the time just makes code convoluted, hard to understand and hard to maintain.
LUA uses the same approach as most other languages when dealing with AND/OR: short-circuiting inclusive logical disjunction on two expressions. In short this means that it will skip the evaluation of the second part of an AND/OR expression if the first one is true.
You can learn more about that by reading here; This is for VB.net that uses the opposite approach for AND/OR but has additional keywords (ANDALSO, ORELSE) that works like AND/OR in other languages.
OrElse: https://msdn.microsoft.com/en-us/library/ea1sssb2.aspx
AndAlso: https://msdn.microsoft.com/en-us/library/cb8x3kfz.aspx