View Single Post
05-07-15, 05:23 PM   #8
Banknorris
A Chromatic Dragonspawn
 
Banknorris's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2014
Posts: 153
I think it would be more didactic to mention that it is an operator precedence issue:
not (which is a unary operator, with the operand on the right side of the operator) will be evaluated in the expression before the == operator (which is a binary operator, with one operand to the left and one the right of the operator). And that is because not has a higher operator precedence than ==.
http://www.lua.org/pil/3.5.html

so

not AddOn == MyAddOn

is the same as

(not Addon) == MyAddon

instead of

not (Addon == MyAddOn)

When you want to change the evaluation order, you can use the parentheses like in the last expression. So
Code:
if not (AddOn == MyAddOn) then
        return
end
__________________
"In this world nothing can be said to be certain, except that fractional reserve banking is a Ponzi scheme and that you won't believe it." - Mandrill
  Reply With Quote