View Single Post
11-10-14, 05:13 PM   #15
Aftermathhqt
A Molten Giant
 
Aftermathhqt's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2009
Posts: 784
Originally Posted by myrroddin View Post
Just so you know, you do not need to explicitly need to check for true, false, or nil in Lua. For readability, these are the same.
Code:
-- the value is true
if a == true then ...
if a ~= false then ...
if a ~= nil then ...
if a then ... <-- use this!

-- the value is false or nil
if a == false then ...
if a == nil then ...
if a ~= true then ...
if not a then ... <-- use this!
Only explicitly check if the value of a can be tri-state, like true/false/nil or 1/0/nil.
Oh okay! Didn't know actually! Thanks
  Reply With Quote