Open main menu
Home
Random
Log in
Settings
About AddOn Studio
Disclaimers
AddOn Studio
Search
Editing
WoW:UI best practices
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
==== Lazy Coding ==== You can utilize the Short-Circuiting functionality to make sure a variable has a value before comparing it to a literal: if foo[bar] == 5 then -- might throw "attempting to index field ? a nil value" DoStuff() end if foo and foo[bar] == 5 then -- will not throw an error DoStuff() end You can also "cheat" if all you want to do is make sure a variable has a value other than nil or false: -- This: if foo then print(foo) elseif bar then print(bar) else print("nothing to print") end -- Can be written as: print(foo or bar or "nothing to print")
Summary:
Please note that all contributions to AddOn Studio are considered to be released under the Creative Commons Attribution-NonCommercial-ShareAlike (see
AddOn Studio Wiki:Copyrights
for details).
Submissions must be written by you, or copied from a public domain or similar free resource (see
AddOn Studio Wiki:Copyrights
for details).
Cancel
Editing help
(opens in new window)
Close
Loading editor…