m
Move page script moved page Common Lua shortcuts to WoW:Common Lua shortcuts without leaving a redirect
mNo edit summary |
m (Move page script moved page Common Lua shortcuts to WoW:Common Lua shortcuts without leaving a redirect) |
||
| (2 intermediate revisions by 2 users not shown) | |||
| Line 1: | Line 1: | ||
{{ | {{wow/uihowto}} | ||
This article covers several syntactic features of Lua that are commonly used in addon code. | This article covers several syntactic features of Lua that are commonly used in addon code. | ||
| Line 7: | Line 7: | ||
For instance: | For instance: | ||
MySVTable = MySVTable or {}; | MySVTable = MySVTable or {}; | ||
print(UnitExists("target") and "You have a target" or "You don't have a target" | print(UnitExists("target") and "You have a target" or "You don't have a target"); -- As a trigraph | ||
A notable limitation of using short-cut evaluation as a trigraph operator is that if the ''true'' expression may return a false value, the false expression will be returned: | A notable limitation of using short-cut evaluation as a trigraph operator is that if the ''true'' expression may return a false value, the false expression will be returned: | ||
| Line 36: | Line 36: | ||
The [[API getglobal|getglobal]]("name") function enables similar behavior, but at a marginally higher cost. | The [[API getglobal|getglobal]]("name") function enables similar behavior, but at a marginally higher cost. | ||
[[Category:Interface customization]] | [[Category:Interface customization]] | ||