Template:Api

From Wowpedia
Jump to: navigation, search

Creates a link to a specific API function or event page with the appropriate label.

t
One of the following:
  • t=a Global API function
  • t=c CVar
  • t=e Event
  • t=t API Type
  • t=o Widget (or UIObject)
  • t=w Widget method (or t=wm)
  • t=wh Widget scripts (or handler)
  • t=x XML element
  • Other advanced combinations exist using ? and / in certain ways... see the examples below.
First unnamed parameter
A properly formatted name such as UnitAura, or UIObject:GetName or PLAYER_LOGIN plus optionally the following:
  • For function/method arguments, arguments as (arg [, optArg])
  • For event payloads, payload as : payload1 payload2 payload3 with a colon at the start and space before each one
  • For XML attributes, attr1. attr2. attr3.val3 using a single space before each attribute and decimal after, and optionally specifying a value right after the decimal
Second unnamed parameter
Text to appear in lieu of the actual function/event/object name (but any parameters will still appear if they were defined)

Runtime API

See also: APIWidget API
Functions (a or default)
Truncates API from the title, colours arguments
{{api|UnitAura(unit, index [, filter])}}
UnitAura(unit, index [, filter])
Events (e)
Colours the payload
{{api|PLAYER_ENTERING_WORLD: isInitialLogin, isReloadingUi|t=e}}
PLAYER_ENTERING_WORLD → isInitialLogin, isReloadingUi
CVars (c)
Links to the CVar page
{{api|farclip|t=c}}
farclip
Widgets (o or o?)
Links to the UIOBJECT page
{{api|Frame|t=o}}
Frame
Widget methods (w or wm)
Truncates API from the title, reformats :, colours arguments
{{api|Texture:SetTexture("filename" or fileID[, "horizWrap"[, "vertWrap"[, "filterMode"]]])|t=w}}
Texture:SetTexture("filename" or fileID[, "horizWrap"[, "vertWrap"[, "filterMode"]]])
Widget handlers (wh)
Links to the UIHANDLER page
{{api|OnClick|t=wh}}
OnClick

XML elements

See also: XML
Start tag (x)
Wraps the tag with < >
{{api|Frame hidden.true frameStrata.LOW|t=x}}
<Frame hidden="trueframeStrata="LOW">
End tag (/x)
Wraps the tag with </ >
{{api|Button name.$parentButton text.|t=/x}}
</Button name="$parentButtontext="">
No children (x/)
Wraps the tag with < />
{{api|Frame|t=x/}}
<Frame />

API Types

See also: API typesTemplate:Expand/API
Basic types (t or t?)
Coloured orange, but not a hyperlink, and use t? to add optional/nilable question mark and tooltip
{{api|nil|t=t}}, {{api|Boolean|t=t}}, {{api|numBER|t=t}}, {{api|STRING|t=t}}, etc.
nil, boolean, number?Optional. Could be nil., string?Optional. Could be nil., etc.
Complex types (t or t?)
Shortens the name for Constants, Enumerations and Structs, but otherwise makes an ordinary blue or red hyperlink to the page
{{api|Enum Club.ClubType|t=t}}, {{api|itemLink|t=t?}}
Enum.ClubType, itemLink?Optional. Could be nil.
Inline Complex Type (i and i?)
Alternate to a link, when an API type is defined 'inline' on the same page. (Such as an enum or struct used only by a single function.)
{{api|Enum QuestSession.QuestSessionPlayerDetails|t=i?|nil=Returns nil if there is no pending request from another party member.}}
Enum.QuestSessionPlayerDetails?Returns nil if there is no pending request from another party member.
Optional/Nilable (t?, o? and i?)
Adds a customizable tooltip to indicate the parameter could be nil. Use nil= to customize the default message. All instances of 'nil' will be shaded automatically in the tooltip.
{{api|boolean|t=t?|nil=Returns nil if the player does not exist.}}
boolean?Returns nil if the player does not exist.