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 27 ■ API <strong>Reference</strong> 1001Returns:localsInfo—A string detailing the local variables at the given stack depth.(string)debugpr<strong>of</strong>ilestartStarts/resets the high resolution pr<strong>of</strong>iling timer.Subsequent calls to debugpr<strong>of</strong>ilestop() will return the current value <strong>of</strong> thetimer.debugpr<strong>of</strong>ilestopReturns the value <strong>of</strong> the pr<strong>of</strong>iling timer.time = debugpr<strong>of</strong>ilestop()Returns:time—Current value <strong>of</strong> the pr<strong>of</strong>iling timer (in milliseconds, withsub-millisecond precision) (number)Example:-- can be used to test the efficiency <strong>of</strong> a segment <strong>of</strong> code:function myFunction()debugpr<strong>of</strong>ilestart()-- function body goes hereprint(<strong>for</strong>mat(“myFunction executed in %f ms“, debugpr<strong>of</strong>ilestop()))enddebugstackReturns in<strong>for</strong>mation about the current function call stack.debugstring = debugstack(start, countTop, countBot)Arguments:start—Stack level at which to begin listing functions; 0 is the debugstack()function itself, 1 is the function that called debugstack(), 2isthefunction that called function 1, etc. Defaults to 1 if omitted (number)countTop—Maximum number <strong>of</strong> functions to output at the top <strong>of</strong> the stacktrace (number)countBot—Maximum number <strong>of</strong> functions to output at the bottom <strong>of</strong> the stacktrace (number)Returns:debugstring—A multi-line string describing the current function call stack(string)Example:print(debugstack())-- output:[string “print(debugstack())“]:1: in main chunk[C]: in function 'RunScript'Interface\FrameXML\ChatFrame.lua:1826: in function '?’Interface\FrameXML\ChatFrame.lua:3332: in function i

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

Saved successfully!

Ooh no, something went wrong!