Quantcast
WoWInterface - View Single Post - Help with if and 'and not'
View Single Post
10-28-16, 04:38 AM   #6
Ketho
A Molten Giant
 
Ketho's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 930
Originally Posted by Krainz View Post
Hi, I'm having trouble understanding the logic within 'if not' and 'and' in the same statement.
Does that mean 'if not' AND 'if and not' or 'if not' AND 'if true'?

You can test it in the Live demo too
http://www.lua.org/cgi-bin/demo

Basically what MunkDev already described
Lua Code:
  1. if not IsMouselooking() and GetMouseFocus() == WorldFrame then
  2.     self.x = x
  3.     self.y = y
  4. end
Lua Code:
  1. not false and false -- false
  2. not true and false -- false
  3. not false and true -- true
  4. not true and true -- false
Truth table: not x and y
Code:
x	|	 xy
false	|	true		false	→	false
true	|	false		false	→	false
false	|	true		truetrue
true	|	false		true	→	false

Last edited by Ketho : 10-28-16 at 04:49 AM.
  Reply With Quote