Commit 3661621b authored by Rainrider's avatar Rainrider Committed by Rainrider

core: update documentation

All the functions in ouf.lua need proper headers
parent 94074d01
......@@ -103,7 +103,7 @@ local function colorsAndPercent(a, b, ...)
end
-- http://www.wowwiki.com/ColorGradient
--[[ oUF:RGBColorGradient(a, b, ...)
--[[ Colors: oUF:RGBColorGradient(a, b, ...)
Used to convert a percent value (the quotient of `a` and `b`) into a gradient from 2 or more RGB colors. If more than 2
colors are passed, the gradient will be between the two colors which perc lies in an evenly divided range. A RGB color
is a sequence of 3 consecutive RGB percent values (in the range [0-1]). If `a` is negative or `b` is zero then the first
......@@ -129,7 +129,7 @@ local function getY(r, g, b)
return 0.299 * r + 0.587 * g + 0.114 * b
end
--[[ oUF:RGBToHCY(r, g, b)
--[[ Colors: oUF:RGBToHCY(r, g, b)
Used to convert a color from RGB to HCY color space.
* self - the global oUF object
......@@ -155,7 +155,7 @@ function oUF:RGBToHCY(r, g, b)
end
local math_abs = math.abs
--[[ oUF:HCYtoRGB(hue, chroma, luma)
--[[ Colors: oUF:HCYtoRGB(hue, chroma, luma)
Used to convert a color from HCY to RGB color space.
* self - the global oUF object
......@@ -196,7 +196,7 @@ function oUF:HCYtoRGB(hue, chroma, luma)
return r, g, b
end
--[[ oUF:HCYColorGradient(a, b, ...)
--[[ Colors: oUF:HCYColorGradient(a, b, ...)
Used to convert a percent value (the quotient of `a` and `b`) into a gradient from 2 or more HCY colors. If more than 2
colors are passed, the gradient will be between the two colors which perc lies in an evenly divided range. A HCY color
is a sequence of 3 consecutive values in the range [0-1]. If `a` is negative or `b` is zero then the first
......@@ -234,7 +234,7 @@ local function HCYColorGradient(...)
end
--[[ oUF:ColorGradient(a, b, ...) or frame:ColorGradient(a, b, ...)
--[[ Colors: oUF:ColorGradient(a, b, ...) or frame:ColorGradient(a, b, ...)
Used as a proxy to call the proper gradient function depending on the user's preference. If `oUF.useHCYColorGradient` is
set to true, `:HCYColorGradient` will be called, else `:RGBColorGradient`.
......
......@@ -52,17 +52,18 @@ local event_metatable = {
end,
}
--[[ frame:RegisterEvent(event, func, unitless)
Used to register a frame for a game event and add an event handler.
--[[ Events: frame:RegisterEvent(event, func, unitless)
Used to register a frame for a game event and add an event handler. OnUpdate polled frames are prevented from
registering events.
* self - frame that will be registered for the given event. OnUpdate polled frames are prevented from registering
events
* event - name of the event to register
* self - frame that will be registered for the given event.
* event - name of the event to register (string)
* func - function that will be executed when the event fires. If a string is passed, then a function by that name
must be defined on the frame. Multiple functions can be added for the same frame and event.
* unitless - boolean indicating that the event does not fire for a specific unit, so the event arguments won't be
must be defined on the frame. Multiple functions can be added for the same frame and event
(string or function)
* unitless - indicates that the event does not fire for a specific unit, so the event arguments won't be
matched to the frame unit(s). Events that do not start with UNIT_ or are not known to be unit events are
automatically considered unitless
automatically considered unitless (boolean)
--]]
function frame_metatable.__index:RegisterEvent(event, func, unitless)
-- Block OnUpdate polled frames from registering events.
......@@ -113,11 +114,11 @@ function frame_metatable.__index:RegisterEvent(event, func, unitless)
end
end
--[[ frame:UnregisterEvent(event, func)
--[[ Events: frame:UnregisterEvent(event, func)
Used to remove a function from the event handler list for a game event.
* self - frame registered for the event
* event - name of the registered event
* self - the frame registered for the event
* event - name of the registered event (string)
* func - function to be removed from the list of event handlers. If this is the only handler for the given event, then
the frame will be unregistered for the event
--]]
......
......@@ -24,12 +24,12 @@ function factory:PLAYER_LOGIN()
wipe(queue)
end
--[[ oUF:Factory(func)
--[[ Factory: oUF:Factory(func)
Used to call a function directly if the current character is logged in and the factory is active. Else the function is
queued up to be executed at a later time (upon PLAYER_LOGIN by default).
* self - the global oUF object
* func - function to be executed or delayed
* func - function to be executed or delayed (function)
--]]
function oUF:Factory(func)
argcheck(func, 2, 'function')
......@@ -42,7 +42,7 @@ function oUF:Factory(func)
end
end
--[[ oUF:EnableFactory()
--[[ Factory: oUF:EnableFactory()
Used to enable the factory.
* self - the global oUF object
......@@ -51,7 +51,7 @@ function oUF:EnableFactory()
factory.active = true
end
--[[ oUF:DisableFactory()
--[[ Factory: oUF:DisableFactory()
Used to disable the factory.
* self - the global oUF object
......@@ -60,7 +60,7 @@ function oUF:DisableFactory()
factory.active = nil
end
--[[ oUF:RunFactoryQueue()
--[[ Factory: oUF:RunFactoryQueue()
Used to try to execute queued up functions. The current player must be logged in and the factory must be active for
this to succeed.
......
......@@ -94,9 +94,9 @@ for k, v in next, {
--[[ frame:EnableElement(name, unit)
Used to activate an element for the given unit frame.
* self - unit frame for that the element should be enabled
* name - name of the element to be enabled
* unit - unit to be passed to the element's Enable function. Defaults to the frame's unit
* self - unit frame for which the element should be enabled
* name - name of the element to be enabled (string)
* unit - unit to be passed to the element's Enable function. Defaults to the frame's unit (string?)
--]]
EnableElement = function(self, name, unit)
argcheck(name, 2, 'string')
......@@ -117,8 +117,8 @@ for k, v in next, {
--[[ frame:DisableElement(name)
Used to deactivate an element for the given unit frame.
* self - unit frame for that the element should be disabled
* name - name of the element to be disabled
* self - unit frame for which the element should be disabled
* name - name of the element to be disabled (string)
--]]
DisableElement = function(self, name)
argcheck(name, 2, 'string')
......@@ -149,7 +149,7 @@ for k, v in next, {
Used to check if an element is enabled on the given frame.
* self - unit frame
* name - name of the element
* name - name of the element (string)
--]]
IsElementEnabled = function(self, name)
argcheck(name, 2, 'string')
......@@ -167,7 +167,7 @@ for k, v in next, {
* self - unit frame
* asState - if true, the frame's "state-unitexists" attribute will be set to a boolean value denoting whether the
unit exists; if false, the frame will be shown if its unit exists, and hidden if it does not
unit exists; if false, the frame will be shown if its unit exists, and hidden if it does not (boolean)
--]]
Enable = RegisterUnitWatch,
--[[ frame:Disable()
......@@ -184,7 +184,7 @@ for k, v in next, {
Used to update all enabled elements on the given frame.
* self - unit frame
* event - event name to pass to the elements' update functions
* event - event name to pass to the elements' update functions (string)
--]]
UpdateAllElements = function(self, event)
local unit = self.unit
......@@ -354,8 +354,8 @@ end
Used to make a (table of) function(s) available to all unit frames.
* self - the global oUF object
* name - unique name of the function
* func - function or a table of functions
* name - unique name of the function (string)
* func - function or a table of functions (function or table)
--]]
function oUF:RegisterMetaFunction(name, func)
argcheck(name, 2, 'string')
......@@ -373,7 +373,7 @@ Used to register a style with oUF. This will also set the active style if it has
* self - the global oUF object
* name - name of the style
* func - (table of) function(s) defining the style
* func - function(s) defining the style (function or table)
--]]
function oUF:RegisterStyle(name, func)
argcheck(name, 2, 'string')
......@@ -389,7 +389,7 @@ end
Used to set the active style.
* self - the global oUF object
* name - name of the style
* name - name of the style (string)
--]]
function oUF:SetActiveStyle(name)
argcheck(name, 2, 'string')
......@@ -573,16 +573,19 @@ do
* self - the global oUF object
* overrideName - unique global name to be used for the header. Defaults to an auto-generated name based on the name
of the active style and other arguments passed to `:SpawnHeader`
of the active style and other arguments passed to `:SpawnHeader` (string?)
* template - name of a template to be used for creating the header. Defaults to `'SecureGroupHeaderTemplate'`
(string?)
* visibility - macro conditional(s) which define when to display the header (string).
* ... - further argument pairs. Consult [Group Headers](http://wowprogramming.com/docs/secure_template/Group_Headers) for possible values.
* ... - further argument pairs. Consult [Group Headers](http://wowprogramming.com/docs/secure_template/Group_Headers)
for possible values.
In addition to the standard group headers, oUF implements some of its own attributes.
These can be supplied by the layout, but are optional.
In addition to the standard group headers, oUF implements some of its own attributes. These can be supplied by the
layout, but are optional.
* oUF-initialConfigFunction - Can contain code that will be securely run at the end of the initial secure configuration (string).
* oUF-onlyProcessChildren - Can be used to force headers to only process children (boolean).
* oUF-initialConfigFunction - can contain code that will be securely run at the end of the initial secure
configuration (string?)
* oUF-onlyProcessChildren - can be used to force headers to only process children (boolean?)
--]]
function oUF:SpawnHeader(overrideName, template, visibility, ...)
if(not style) then return error('Unable to create frame. No styles have been registered.') end
......@@ -639,8 +642,9 @@ end
Used to create a single unit frame and apply the currently active style to it.
* self - the global oUF object
* unit - the frame's unit
* unit - the frame's unit (string)
* overrideName - unique global name to use for the unit frame. Defaults to an auto-generated name based on the unit
(string?)
--]]
function oUF:Spawn(unit, overrideName)
argcheck(unit, 2, 'string')
......@@ -665,11 +669,10 @@ end
Used to create nameplates and apply the currently active style to them.
* self - the global oUF object
* prefix - prefix for the global name of the nameplate. Defaults to an auto-generated prefix
* callback - function to be called after a nameplate unit or the player's target has changed.
The arguments passed to the callback are the updated nameplate,
the event that triggered the update and the new unit.
* variables - table of console variable-value pairs to be set when the player logs in
* prefix - prefix for the global name of the nameplate. Defaults to an auto-generated prefix (string?)
* callback - function to be called after a nameplate unit or the player's target has changed. The arguments passed to
the callback are the updated nameplate, the event that triggered the update and the new unit (function?)
* variables - list of console variable-value pairs to be set when the player logs in (table?)
--]]
function oUF:SpawnNamePlates(namePrefix, nameplateCallback, nameplateCVars)
argcheck(nameplateCallback, 3, 'function', 'nil')
......@@ -750,10 +753,10 @@ end
Used to register an element with oUF.
* self - the global oUF object
* name - unique name of the element
* update - function used to update the element
* enable - function used to enable the element for a given unit frame and unit
* disable - function used to disable the element for a given unit frame
* name - unique name of the element (string)
* update - used to update the element (function?)
* enable - used to enable the element for a given unit frame and unit (function?)
* disable - used to disable the element for a given unit frame (function?)
--]]
function oUF:AddElement(name, update, enable, disable)
argcheck(name, 2, 'string')
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment