WoW:Common Lua shortcuts: Difference between revisions

m
no edit summary
 
mNo edit summary
Line 9: Line 9:
  print(UnitExists("target") and "You have a target" or "You don't have a target")); -- As a trigraph
  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 oeprator 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:
  function isFrameShown(frame, checkParentFrames)
  function isFrameShown(frame, checkParentFrames)
   -- The expression below returns the wrong value if frame's parent is hidden.
   -- The expression below returns the wrong value if frame's parent is hidden.
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]]
Anonymous user