Chapter 27
API Reference
999
ZoomOut
Setsthe world mapto show the areacontaining its current area.
Only used by the default UIincertaincircumstances: to ‘‘zoom out’’ from a
multi-levelmap (e.g. Dalaranor a dungeon) to the containing zone/continent.
May cause problems when not used insuch cases.
Lua API
abs
Returnsthe absolute value of a number.
absoluteValue= abs(x)
Aliasfor the standard library functionmath.abs.
Arguments:
x—Anumber(number)
Returns:
absoluteValue—Absolutevalueofx(number)
Lua API
assert
Causes aLuaerror if a conditionisfailed.
value= assert(condition,“message“)
Arguments:
condition—Anyvalue(commonlytheresultofanexpression)(value)
message—Errormessagetobeproducedifconditionis falseornil
(string)
Returns:
value—Theconditionvalueprovided,ifnotfalseornil(value)
Example:
assert(x< y)
--causesa Luaerrorifthe value ofx is notless than the value
--of ywhencalled
assert(notUnitIsDead(“player“),“Ohnoes!“))
--causesa Luaerrorwithtext “Oh noes!“ifthe playeris dead
--when called
Lua API
ceil
Returnsthe smallest integer larger thanor equal to a number.
ceiling=ceil(x)
Aliasfor the standard library functionmath.ceil.
Arguments:
x—Anumber(number)
Returns:
ceiling—Smallestintegerlargerthanorequaltox(number)
Lua API
collectgarbage
Interface to the Lua garbage collector.
collectgarbage(option[,arg])
Pdf change page order - re-order PDF pages in C#.net, ASP.NET, MVC, Ajax, WinForms, WPF
Support Customizing Page Order of PDF Document in C# Project
pdf rearrange pages online; move pages in a pdf file
Pdf change page order - VB.NET PDF Page Move Library: re-order PDF pages in vb.net, ASP.NET, MVC, Ajax, WinForms, WPF
Sort PDF Document Pages Using VB.NET Demo Code
pdf reverse page order online; reorder pages in pdf preview
1000 Part IV
Reference
Arguments:
option—Oneofthefollowingoptions
collect—Performsafullgarbagecollectioncycle
count—ReturnsthetotalLuamemoryusage(inkilobytes)
restart—Restartsthegarbagecollector
setpause—Setsthegarbagecollector’spausepercentagetoarg;e.g.,if200,
the collector waitsfor memory usage to double before starting a new cycle
setstepmul—Setsthegarbagecollector’sspeed(asapercentagerelativeto
memory allocation) toarg; e.g., if 200, the collector runs twice asfast asmem-
ory is allocated
step—Performsagarbagecollectionstep,withsizearg
stop—Stops thegarbagecollector
arg(optional)—Argumentapplicabletosomeoptions
Lua API
date
Returns aformatted date/time string for adate (or the current date).
dateValue= date([“format“[,time]])
Alias to the standard library functionos.date.
Arguments:
format(optional)—Astringdescribingtheformattingoftimevalues(as
in the ANSI Cstrftime()function), or*t to return the time as a table;
optionally preceded by! for Coordinated Universal Time instead of the
local time zone; omitted for a date printed in the default format (string)
time(optional)—Timevaluetobeformatted(see time()fordescription);if
omitted, uses the current time (number)
Returns:
dateValue—Aformatteddate/timestring,(string or table)
Examples:
-- Example #1
date()
-- returns (e.g.)“Sun Jun 14 01:31:412009“
-- Example #2
date(“*t“)
-- returns {hour=1,min=31, sec=41, wday=1,day=14,month=6,
-- year=2009, yday=165,isdst=true}
debuglocals
Returns information about the local variablesat agiven stack depth.
localsInfo=debuglocals(stackLevel)
Arguments:
stackLevel—Thestackleveltoquery(number)
VB.NET Word: Change Word Page Order & Sort Word Document Pages
Note: if you are trying to change the order controls, please read this Word reading page which has powerful & profession imaging controls, PDF document, image
reorder pdf pages reader; how to change page order in pdf acrobat
C# Word - Process Word Document in C#
various Word document processing implementations using C# demo codes, such as add or delete Word document page, change Word document pages order, merge or
how to reorder pages in pdf online; reordering pages in pdf document
Chapter 27
API Reference 1001
Returns:
localsInfo—Astringdetailingthelocalvariablesatthegivenstackdepth.
(string)
debugprofilestart
Starts/resetsthe high resolutionprofiling timer.
Subsequent calls todebugprofilestop() will returnthe current value of the
timer.
debugprofilestop
Returnsthe value of the profiling timer.
time =debugprofilestop()
Returns:
time—Currentvalueoftheprofilingtimer(inmilliseconds,with
sub-millisecond precision) (number)
Example:
--canbeused to testthe efficiency of asegmentof code:
functionmyFunction()
debugprofilestart()
--function bodygoes here
print(format(“myFunction executed in %f ms“,debugprofilestop()))
end
debugstack
Returnsinformationabout the current function call stack.
debugstring= debugstack(start, countTop,countBot)
Arguments:
start—Stacklevelatwhichtobeginlistingfunctions;0isthedebugstack()
function itself,1 is the function that calleddebugstack(), 2 is the
function that called function 1, etc. Defaultsto1 if omitted (number)
countTop—Maximumnumberoffunctionstooutputatthetopofthestack
trace (number)
countBot—Maximumnumberoffunctionstooutputatthebottomofthestack
trace (number)
Returns:
debugstring—Amulti-linestringdescribingthecurrentfunctioncallstack
(string)
Example:
print(debugstack())
--output:
[string“print(debugstack())“]:1: inmainchunk
[C]:infunction'RunScript'
Interface\FrameXML\ChatFrame.lua:1826:in function'?’
Interface\FrameXML\ChatFrame.lua:3332:in functioni
C# PDF File & Page Process Library SDK for C#.net, ASP.NET, MVC
Convert Jpeg to PDF; Merge PDF Files; Split PDF Document; Remove Password from PDF; Change PDF Permission Settings. C# File: Split PDF; C# Page: Insert PDF pages
reverse page order pdf online; pdf change page order acrobat
C# PowerPoint - Sort PowerPoint Pages Order in C#.NET
control, developers can swap or adjust the order of all or several PowerPoint document pages, or just change the position of certain one PowerPoint page in an
move pdf pages online; how to move pages around in a pdf document
1002 Part IV
Reference
’ChatEdit_ParseText’
Interface\FrameXML\ChatFrame.lua:3052:in function 'ChatEdit_SendText’
Interface\FrameXML\ChatFrame.lua:3073:in functioni
<Interface\FrameXML\ChatFrame.lua:3072>
[C]: in function'ChatEdit_OnEnterPressed'
[string“*:OnEnterPressed“]:1: infunctioni
<[string“*:OnEnterPressed“]:1>
Lua API
deg
Converts an angle measurement in radians to degrees.
degrees =deg(radians)
Alias for the standard library functionmath.deg.
Arguments:
radians—Ananglespecifiedinradians(number)
Returns:
degrees—Theanglespecifiedindegrees(number)
Lua API
difftime
Returns the number of seconds between two time values.
seconds =difftime(time2,time1)
Alias for the standard library functionos.difftime.
Arguments:
time2—Atimevalue(seetime()fordescription)(number)
time1—Atimevalue(seetime()fordescription)(number)
Returns:
seconds—Numberofsecondsbetweentime2and time1;equiva-
lent totime2—time1
on all current WoW clients (number)
Lua API
error
Causes aLua error message.
error(“message“ [, level])
Arguments:
message—Anerrormessagetobedisplayed(string)
level(optional)—Levelinthefunctionstackatwhichtheerrormessage
begins providing function information; e.g.1 (the default, if omitted) to start at
the position whereerror() was called, 2to start at the function which called
error(),3tostartatthefunctionwhichcalledthatfunction,etc.(number)
Lua API
exp
Returns the value of the exponential function for a number.
exp= exp(x)
Alias for the standard library functionmath.exp.
Arguments:
x—Anumber (number)
C# Word - Sort Word Pages Order in C#.NET
library control, developers can swap or adjust the order of all or several Word document pages, or just change the position of certain one Word page in an
how to move pages in pdf reader; rearrange pages in pdf reader
VB.NET PDF File & Page Process Library SDK for vb.net, ASP.NET
VB.NET PDF - How to Modify PDF Document Page in VB.NET. VB.NET Guide for Processing PDF Document Page and Sorting PDF Pages Order.
how to rearrange pdf pages in preview; reorder pages of pdf
Chapter 27
API Reference 1003
Returns:
exp—Valueofthemathematicalconstant*e*(Euler’snumber)raisedtothexth
power (number)
Lua API
floor
Returnsthe largest integer smaller thanor equalto a number.
floor= floor(x)
Aliasfor the standard library functionmath.floor.
Arguments:
x—Anumber(number)
Returns:
floor—Largestintegersmallerthanorequaltox(number)
forceinsecure
Causes the current executionpath to continue outside the secure environment.
Meaninglesswhen called from outside of the secure environment.
Lua API
format
Returnsa formattedstring containing specified values.
formatted =format(“formatString“, ...)
Aliasfor the standard library functionstring.format. This version, however,
includesthe positional argument specifiers from Lua 4.0.
Luadoesnot support the ANSIC format specifiers*,l,L,n,p, andh but
includesanextraspecifier,q, which formats astring inaform suitable to be
safely read back by the Lua interpreter; the string iswrittenbetween double
quotes, and all double quotes, newlines, embedded zeros, and backslashesin
the string are correctly escaped whenwritten.
Arguments:
formatString—AstringcontainingformatspecifiersaspertheANSIC
printf function (string)
...—Alistofvaluestobeincludedintheformattedstring(list)
Returns:
formatted—Theformattedstring(number)
Example:
string.format(“%s %q“,“Hello“, “Azeroth!“) -- stringand quotedstring
--returns 'Hello“Azeroth!“’
string.format(“%c%c%c“, 76,117,97)
--char
--returns 'Lua’
string.format(“%e,%E“, math.pi,math.pi)
--exponent
--returns '3.141593e+000, 3.141593E+000’
string.format(“%f,%g“, math.pi,math.pi)
--floatand compact float
--returns '3.141593, 3.14159’
string.format(“%d,%i,%u“, -100,-100,-100) -- signed, signed,i
unsignedinteger
--returns '-100,-100,4294967196’
string.format(“%o,%x,%X“, -100,-100,-100) -- octal,hex, hex
--returns '37777777634,ffffff9c,FFFFFF9C’
C# TIFF: How to Reorder, Rearrange & Sort TIFF Pages Using C# Code
C# users to reorder and rearrange multi-page Tiff file Tiff image management library, you can easily change and move pages or make a totally new order for all
how to rearrange pages in pdf using reader; reorder pages pdf
VB.NET PDF Password Library: add, remove, edit PDF file password
On this page, we will illustrate how to protect PDF document via password by using Change PDF original password. VB.NET: Necessary DLLs for PDF Password Edit.
how to rearrange pages in a pdf file; how to move pages in a pdf file
1004 Part IV
Reference
Lua API
frexp
Returns the normalized fractionand base-2exponent for a number.
m, e= frexp(x)
Alias for the standard library functionmath.frexp.
Arguments:
x—Anumber (number)
Returns:
m—Anumberwhoseabsolutevalueisintherange[0.5,1),or0ifxis0(number)
e—Aninteger,suchthatx = m * 2 &circ; e(number)
geterrorhandler
Returns the current error handler function.
handler =geterrorhandler()
Returns:
handler—Thecurrenterrorhandler(function)
Example:
localmyError =“Somethingwent horriblywrong!“
geterrorhandler()(myError)
Lua API
getfenv
Returns the environment for afunction (or the global environment).
env= getfenv([f])orgetfenv([stackLevel])
If the environment has a__environment metatable, that value is returned
instead.
Arguments:
f(optional)—Afunction(function)
stackLevel(optional)—Levelofafunctioninthecallingstack(number)
Returns:
env—Tablecontainingallvariablesinthefunction’senvironment,or
the global environment iff orstackLevel is omitted (table)
getglobal
Returns the value of aglobal variable.
value= getglobal(“name“)
Often used in the default UIin caseswhere several similar namesare
systematically constructed. Examples:
In ascript attached to a frame template,getglobal(self:GetName()..
“Icon“)canrefertotheTexturewhosenameisdefinedinXMLas
$parentIcon.
Chapter 27
API Reference 1005
Several sets of localized string tokens follow standard formats: e.g.
getglobal(“ITEM_QUALITY“..quality..“_DESC)returnsthenamefor
the numeric quality.
Equivalent to_G.name or_G[“name“].
Arguments:
name—Nameofaglobalvariable(string)
Returns:
value—Valueofthegivenvariable(value)
Lua API
getmetatable
Returnsanobject’s metatable.
metatable =getmetatable(object)
Arguments:
object—Anytableoruserdataobject(value)
Returns:
metatable—Contentsoftheobject’s__metatablefield,orniliftheobjecthas
no metatable (value)
Lua API
gmatch
Returnsaniterator functionfor finding pattern matchesina string.
iterator= gmatch(“s“,“pattern“)
Aliasfor the standard library functionstring.gmatch.
Arguments:
s—Astring(string)
pattern—Aregularexpressionpattern(string,pattern)
Returns:
iterator—Afunctionwhich,eachtimeitiscalled,returnsthenextcaptureof
patterninthestring s;alwaysreturnsthewholestringif patternspecifiesno
captures (function)
Example:
--printthecomponentsofanitem link
forw in gmatch(link, “([%d-]+)“) do
print(w)
end
--example output, given an enchantedHeavyLamellar
--Gauntlets of the Gorilla:
--10242
--2564
--0
--0
--0
--0
--614
--0
1006 Part IV
Reference
Lua API
gsub
Returns a string inwhich occurrencesof a patternare replaced.
newString,numMatched =gsub(“s“, “pattern“, “rep“ [, maxReplaced]) ori
gsub(“s“,“pattern“,repTable [, maxReplaced]) orgsub(“s“, “pattern“,i
repFunc [, maxReplaced])
Alias for the standard library functionstring.gsub.
Arguments:
s—Astring(string)
pattern—Aregularexpressionpattern(string,pattern)
rep—Stringwithwhichtoreplaceoccurrencesofpattern;maycon-
tain specifiers for numbered captures in thepattern (string)
repTable—Tablecontainingreplacementstrings;replacementsarelookedup
using captured substrings as keys, or the entire matchifpattern specifies no
captures (table)
repFunc—Functiontosupplyreplacementstrings;calledwithcaptured
substrings (or the entire match ifpattern specifies no captures) as arguments
(function)
maxReplaced(optional)—Maximumnumberofreplacementstobemade
(number)
Returns:
newString—Acopyofsinwhichoccurrencesofthe patternhavebeen
replaced as specified (string)
numMatched—Numberofmatchesfound(number)
Example:
gsub(“banana“,“a“,“A“, 2)
-- returns “bAnAna“,2
gsub(“banana“,“(a)(n)“, “%2%1“)
-- returns “bnanaa“,2
gsub(“banana“,“[an]“,{a=“o“,n=“m“})
-- returns “bomomo“,5
gsub(“banana“,“(a)“, strupper)
-- returns “bAnAnA“,3
hooksecurefunc
Add a function to be called after execution of a secure function.
hooksecurefunc([table,]“function“,hookfunc)
Allowsone to ‘‘post-hook’’ a secure functionwithout tainting the original.
The original function willstill be called, but the functionsupplied will be called
after the original, withthe same arguments. Return values from the supplied
function are discarded. Note that there isno API to remove a hook from a
function: any hooks applied will remainin place until the UIis reloaded.
Only allows hooking of functions named by a globalvariable; to hook a script
handler on aFrame object, seeFrame:HookScript().
Chapter 27
API Reference 1007
Arguments:
table(optional)—Atableobjectthatcontainsthefunctiontobehooked(table)
function—Thenameofthefunctiontobehooked(string)
hookfunc—Thefunctiontobecalledeachtimetheoriginalfunctioniscalled
(function)
Examples:
--Example #1
--Keep acounterof howmany timesyour characterhasjumped,
--anddisplayinchat
localcounter= 0
localfunctionhook_JumpOrAscendStart(...)
counter= counter +1
ChatFrame1:AddMessage(“Boing! Boing!-“ .. counter .. “jumps.“)
end
hooksecurefunc(“JumpOrAscendStart“, hook_JumpOrAscendStart)
--Example #2
--Hook GameTooltip:SetAction()todisplayhow manyspellcastsyou can
--make.It does thisbyscanningthe secondline of the tooltip,and
--matchingitagainstthepattern“(%d+)“ .. MANA, where MANA isthe
--globalstring for“Mana“ in the current locale.
localfunctionhook_SetAction(self,...)
--The secondline of the tooltip is
--getglobal(self:GetName()..“TextLeft2“)
localline= getglobal(self:GetName().. “TextLeft2“)
localtext= line:GetText()or““
localmanaCost =text:match(“(%d+) “..MANA)
ifmanaCost then
-- Convert the manacosttoa number
manaCost= tostring(manaCost)
-- Get theplayer’scurrentmana,and calculatethenumnberofcasts
local mana =UnitMana(“player“)
local numCasts=math.floor(mana/ manaCost)
-- Add theline to thetooltip,coloredblue
self:AddLine(“Youcan castthis spell“ ..numCasts ..i
“times“,0.4,0.4, 1.0)
-- Callthisto ensurethe tooltipisproperlyresized
self:Show()
end
end
hooksecurefunc(GameTooltip,“SetAction“,hook_SetAction)
Lua API
ipairs
Returnsaniterator functionfor integer keysin atable.
iterator, t, index =ipairs(t)
Return valuesare such that the construction
for k,v in ipairs(t) do
-- body
end
1008 Part IV
Reference
will iterate over the pairs1,t[1],2,t[2], etc, up to the first integer key
absent from the table.
Arguments:
t—Atable (table)
Returns:
iterator—Aniterator(function)
t—Thetableprovided(table)
index—Always0;usedinternally(number)
issecure
Returns whether the current executionpath is secure.
secure= issecure()
Meaninglesswhencalled from outside of the secure environment: always
returnsnil insuchsituations.
Returns:
secure1ifthecurrentexecutionpathissecure;otherwise nil(1nil)
issecurevariable
Returns whether avariable is secure (and if not, whichaddon tainted it).
issecure,taint =issecurevariable([table,]“variable“)
Arguments:
table(optional)—Atabletobeusedwhencheckingtableelements(table)
variable—Thenameofavariabletocheck.Inordertocheckthestatusofa
table element, you should specify the table, and then the key of the element
(string)
Returns:
issecure1ifthevariableissecure;otherwise nil(1nil)
taint—Nameoftheaddonthattaintedthevariable,ornilifthevariableis
secure (string)
Lua API
ldexp
Returns the number generated by anormalized fraction and base-2 exponent.
x=ldexp(m,e)
Alias for the standard library functionmath.ldexp.
Arguments:
m—Anumber (number)
e—Anumber (number)
Returns:
x—Thevalueof m * 2 ˆ e(number)
Lua API
loadstring
Loadsand compiles Lua source code.
chunk,error= loadstring(“s“[,“chunkname“])
Documents you may be interested
Documents you may be interested