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...

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Chapter 6 ■ Lua St<strong>and</strong>ard Libraries 109> print(strconcat(“alpha:“, “beta:“, “gamma“))alpha:beta:gammagetglobal(name) takes a variable name as a string <strong>and</strong> returns the so-namedglobal variable, if it exists. This function is deprecated in <strong>World</strong> <strong>of</strong> <strong>Warcraft</strong>,meaning it should no longer be used but has not yet been removed. It isincluded, along with setglobal,incaseyouseeitincodefromolderaddons.> greek1, greek2, greek3 = “alpha“, “beta“, “gamma“> <strong>for</strong> i=1,3 do>> print(getglobal(“greek“ .. i))>> endalphabetagammaThe setglobal(name, value) function takes a variable name as a string,along with a corresponding value, <strong>and</strong> sets the so-named global variable tothe new value.> print(myVariable)nil> setglobal(“myVariable“, 17)> print(myVariable)17The debugstack([start[, count1[, count2]]]) function returns the currentcalling stack according to three inputs, as described in Table 6-9.Table 6-9: debugstack InputsINPUT TYPE DESCRIPTIONstart Number The stack depth at which to start the stack trace (defaults to 1,the function calling debugstack)count1 Number The number <strong>of</strong> functions to output at the top <strong>of</strong> the stack(default 12)count2 Number The number <strong>of</strong> functions to output at the bottom <strong>of</strong> the stack(default 10)This function only operates correctly in <strong>WoW</strong>. The st<strong>and</strong>alone Lua interpreterhas its own method <strong>of</strong> providing stack traces.Function AliasesIn <strong>World</strong> <strong>of</strong> <strong>Warcraft</strong>, many <strong>of</strong> the library functions have been given shorteraliases so they are easier to access <strong>and</strong> type. Table 6-10 contains a full listing <strong>of</strong>these aliases.

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

Saved successfully!

Ooh no, something went wrong!