12.07.2015 Views

Wiley-World.of.Warcraft.Programming.A.Guide.and.Reference.for.Creating.WoW.Addons

Wiley-World.of.Warcraft.Programming.A.Guide.and.Reference.for.Creating.WoW.Addons

Wiley-World.of.Warcraft.Programming.A.Guide.and.Reference.for.Creating.WoW.Addons

SHOW MORE
SHOW LESS
  • No tags were found...

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Chapter 11 ■ Exploring the <strong>World</strong> <strong>of</strong> <strong>Warcraft</strong> API 189Table 11-1: Library Functions <strong>and</strong> Their API EquivalentsSTANDARD LIBRARYEQUIVALENT WOW APIos.datedateos.timeos.difftimedebug.tracebacktimedifftimedebugstackIn addition to direct library translations, several functions specific to <strong>WoW</strong>play a support role in addon development but do not directly relate to anythingin-game. These have semantics similar to library functions but are technicallypart <strong>of</strong> the <strong>WoW</strong> API. They are easily identifiable because their names areentirely lowercase—debugpr<strong>of</strong>ilestart <strong>and</strong> hooksecurefunc, <strong>for</strong>instance.Some <strong>of</strong> these functions are defined by the game client, but others are definedinthegame’sFrameXMLcode.FrameXML FunctionsThe code <strong>for</strong> the default user interface includes definitions <strong>for</strong> a number <strong>of</strong>utility functions. Although they may not be considered APIs in the strictestsense, their usage is consistent enough with true API functions that theydeserve documentation here. For example, consider the definition <strong>of</strong> theTakeScreenshot function:function TakeScreenshot()if ( ActionStatus:IsShown() ) thenActionStatus:Hide();endScreenshot();endThis function is designed to make it easier to take screenshots programmatically.Normally after you take a screenshot the ‘‘Screen Captured’’ message isdisplayed. This function hides that text so you can take multiple screenshotsin quick succession.The most unique characteristic <strong>of</strong> FrameXML-defined functions is that youcan examine their inner workings. All <strong>of</strong> the APIs mentioned so far are hiddenbehind the Lua-C interface. You can call the functions from Lua <strong>and</strong> use thevalues they return, but in general there is no way to know exactly how theyoperate.Protected FunctionsEarly in <strong>WoW</strong>’s life, addons had free reign over all functions available in theAPI. Some <strong>of</strong> these functions included movement control, combat activities,

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!