Lore archive · Warcraft Wiki, 2023 dump
Lua Coding Tips
Last wiki revision 2021-10-27
This is a guideline for best practices when writing Lua code.
Try to use local variables whenever possible.
- References: WowAce coding tips
Ideally an addon should use only a single unique global. For instance, the global variable is written and read by more than a hundred addons.
Use instead of the deprecated getglobal
Any value other than and is truthy. Similarly, use the operator unless you want to explicitly check for or. Although this generally is a case of user preferences and coding style.
Source
https://warcraft.wiki.gg/wiki/Lua_Coding_Tips · retrieved 2023-11-13 · CC BY-SA 4.0
Converted from wikitext with templates, tables and images removed, so some sentences may be missing values.
This archive predates WoW: Forever. For collected gameplay facts see the Forever database. Search the archive.