LibDogTag-3.0/API Documentation
From WowAce Wiki
API Documentation
Note: This documentation is auto-generated. Please note that direct modifications may be overwritten on next autogenerate.
:AddAddonFinder("namespace" , "kind" , "name" , func)
Arguments
- "namespace"
- string - namespace the addon finder is associated with
- "kind"
- string - "_G" for a value on the global table or "LibStub", "Rock", "AceLibrary" for a library of the specified type
- "name"
- string - name of the addon or library
- func
- function - function to be called when addon or library is found
Notes
Adds a handler to be called when an addon or library comes into being This should only really be called by sublibraries or addons that register tags.
Example
LibStub("DogTag-3.0"):AddAddonFinder("MyNamespace", "LibStub", "LibMonkey-1.0", function(LibMonkey)
-- do something with LibMonkey now
end)
string table
:AddFontString(fs , frame , "code" [, nsList] [, kwargs])
Arguments
- fs
- frame - the FontString to register
- frame
- frame - the Frame which holds the FontString
- "code"
- string - the tag sequence
- nsList
- string - a semicolon-separated list of namespaces. Base is implied
- kwargs
- table - a dictionary of default kwargs for all tags in the code to receive
Notes
Adds a FontString to LibDogTag-3.0's registry, which will be updated automatically. You can add twice without removing. It will just overwrite the previous registration. You can specify any number of namespaces. "Base" is always included as a namespace. The kwargs table is optional and always goes on the end after the namespaces. You can recycle the table after registering.
Example
LibStub("LibDogTag-3.0"):AddFontString(fs, fs:GetParent(), "[Name]", "Unit", { unit = 'mouseover' })
LibStub("LibDogTag-3.0"):AddFontString(fs, fs:GetParent(), "[Tag]", "MyNamespace")
LibStub("LibDogTag-3.0"):AddFontString(fs, fs:GetParent(), "[Tag] [Name]", "MyNamespace;Unit", { value = 5, unit = 'player', }) -- two namespaces at once
:AddTag("namespace" , "tag" , data)
Arguments
- "namespace"
- string - namespace to add to
- "tag"
- string - name of the tag
- data
- table - data of the tag
Notes
Adds a tag to the specified namespace
Example
LibStub("LibDogTag-3.0"):AddTag("MyNamespace", "Square", {
code = function(number) -- actual function that will be called
return number * number
end,
arg = {
'number', 'number', '@req', -- name, types, default
},
ret = 'number', -- return value
events = "SOME_EVENT#$number", -- will update when SOME_EVENT with the argument `number` is dispatched
doc = "Return the square of number", -- the description
example = '[4:Square] => "16"; [5:Square] => "25"', -- show one or more examples in this format
category = "Category name",
})
:ClearNamespace("namespace")
Arguments
- "namespace"
- string - namespace that is to be cleared
Notes
Clears a namespace's tags and any other relevant data. This should be called when a sublibrary is upgrading.
Example
LibStub("LibDogTag-3.0"):ClearNamespace("MyNamespace")
:RemoveFontString(fs)
Arguments
- fs
- frame - the FontString previously registered
Notes
Removes a registered FontString from LibDogTag-3.0's registry. You can remove twice without issues.
Example
LibStub("LibDogTag-3.0"):RemoveFontString(fs)
:UpdateAllForFrame(frame)
Arguments
- frame
- frame - the frame which to update all FontStrings on
Notes
Manually updates all FontStrings on a specified frame.
Example
LibStub("LibDogTag-3.0"):UpdateAllForFrame(frame)
:UpdateFontString(fs)
Arguments
- fs
- frame - the FontString previously registered
Notes
Manually updates a FontString previously registered.
Example
LibStub("LibDogTag-3.0"):UpdateFontString(fs)
API Documentation
Note: This documentation is auto-generated. Please note that direct modifications may be overwritten on next autogenerate.
:AddCompilationStep("namespace" , "kind" , func)
Arguments
- "namespace"
- string - namespace to run the compilation step on
- "kind"
- string - kind of compilation step, can be "pre", "start", "tag", "tagevents", or "finish"
- func
- function - the function to run
Example
DogTag:AddCompilationStep("MyNamespace", "start", function(t, ast, kwargTypes, extraKwargs)
-- do something here
end)
string table
:CreateFunctionFromCode("code" [, nsList] [, kwargs] [, notDebug])
Arguments
- "code"
- string - a tag sequence
- nsList
- string - a semicolon-separated list of namespaces. Base is implied
- kwargs
- table - a dictionary of default kwargs for all tags in the code to receive
- notDebug
- type - (needs documentation)
Notes
This is mostly used for debugging purposes
Returns
string - a block of code which could have loadstring called on it.
Example
local funcCode = LibStub("LibDogTag-3.0"):CreateFunctionFromCode("[Name]", "Unit", { unit = 'player' })
string table
:Evaluate("code" [, nsList] [, kwargs])
Arguments
- "code"
- string - the tag sequence to compile and evaluate
- nsList
- string - a semicolon-separated list of namespaces. Base is implied
- kwargs
- table - a dictionary of default kwargs for all tags in the code to receive
Returns
string, number, or nil - the resultant generated text number or nil - the expected opacity of the generated text, specified by the [Alpha(num)] tag. nil if not specified. string - the outline style, can be "", "OUTLINE", or "OUTLINE, THICKOUTLINE"
Example
local text = LibStub("LibDogTag-3.0"):Evaluate("[Name]", "Unit", { unit = 'player' })
string
:RemoveAllCompilationSteps("namespace" [, kind])
Arguments
- "namespace"
- string - namespace to run the compilation step on
- kind
- string - kind of compilation step, can be "pre", "start", "tag", "tagevents", or "finish", if not specified, then all kinds
Example
DogTag:RemoveAllCompilationSteps("MyNamespace", "start")
DogTag:RemoveAllCompilationSteps("MyNamespace")
:RemoveCompilationStep("namespace" , "kind" , func)
Arguments
- "namespace"
- string - namespace to run the compilation step on
- "kind"
- string - kind of compilation step, can be "pre", "start", "tag", "tagevents", or "finish"
- func
- function - the function to run
Example
DogTag:RemoveCompilationStep("MyNamespace", "start", func)
API Documentation
Note: This documentation is auto-generated. Please note that direct modifications may be overwritten on next autogenerate. string table value
:AddCallback("code" , callback [, nsList] [, kwargs] [, extraArg])
Arguments
- "code"
- string - the tag sequence
- callback
- function - the function to be called
- nsList
- string - a semicolon-separated list of namespaces. Base is implied
- kwargs
- table - a dictionary of default kwargs for all tags in the code to receive
- extraArg
- value - a value that will be passed into the callback
Notes
Adds a callback that will be called if the code in question is to be updated.
Example
LibStub("LibDogTag-3.0"):AddCallback("[Name]", function(code, kwargs)
-- do something here
end, "Unit", { unit = 'player' })
:AddEventHandler("namespace" , "event" , func)
Arguments
- "namespace"
- string - the namespace to mark ownership with
- "event"
- string - the name of the event
- func
- function - the function to be called
Notes
Register a function to be called when the event is fired This should only be called by sublibraries
Example
LibStub("LibDogTag-3.0"):AddEventHandler("MyNamespace", "PLAYER_LOGIN", function(event, ...)
-- do something here.
end)
number
:AddTimerHandler("namespace" , func [, priority])
Arguments
- "namespace"
- string - the namespace to mark ownership with
- func
- function - the function to be called
- priority
- number - a number from 1 to 9 specifying the priority it will be called compared to other timers. 1 being called first and 9 being called last. Is 5 by default.
Notes
Register a function to be called roughly every 0.05 seconds This should only be called by sublibraries
Example
LibStub("LibDogTag-3.0"):AddTimerHandler("MyNamespace", function(num, currentTime)
-- do something here.
end)
:FireEvent("event" , ...)
Arguments
- "event"
- string - name of the event
- ...
- tuple - a tuple of arguments
Notes
Fire an event that any tags, handlers, or callbacks will see.
Example
LibStub("LibDogTag-3.0"):FireEvent("MyEvent", "Data", "goes", "here", 52)
string table
:RemoveCallback("code" , callback [, nsList] [, kwargs] [, extraArg])
Arguments
- "code"
- string - the tag sequence
- callback
- function - the function to be called
- nsList
- string - a semicolon-separated list of namespaces. Base is implied
- kwargs
- table - a dictionary of default kwargs for all tags in the code to receive
- extraArg
- type - (needs documentation)
Notes
Remove a callback that has been previously added
Example
LibStub("LibDogTag-3.0"):RemoveCallback("[Name]", func, "Unit", { unit = 'player' })
:RemoveEventHandler("namespace" , "event" , func)
Arguments
- "namespace"
- string - the namespace to mark ownership with
- "event"
- string - the name of the event
- func
- function - the function to be called
Notes
Remove an event handler that has been previously added This should only be called by sublibraries
Example
LibStub("LibDogTag-3.0"):RemoveEventHandler("MyNamespace", "PLAYER_LOGIN", func)
:RemoveTimerHandler("namespace" , func)
Arguments
- "namespace"
- string - the namespace to mark ownership with
- func
- function - the function to be called
Notes
Remove a timer handler that has previously been added This should only be called by sublibraries
Example
LibStub("LibDogTag-3.0"):RemoveTimerHandler("MyNamespace", func)
API Documentation
Note: This documentation is auto-generated. Please note that direct modifications may be overwritten on next autogenerate.
:CleanCode("code")
Arguments
- "code"
- string - the tag sequence to check
Notes
This takes a tag sequence that a user can enter and updates it for style purposes. e.g. [name] => [Name], [5-12] => [5 - 12]
Returns
string - the same tag sequence, corrected for style.
Example
local code = LibStub("LibDogTag-3.0"):CleanCode("[name][level]") -- "[Name Level]"
:ColorizeCode("code")
Arguments
- "code"
- string - the tag sequence to check
Notes
This colorizes a tag sequence by syntax to make it easier to understand. This does not correct casing or change whitespace, merely adds tags.
Returns
string - the same tag sequence, with colors applied.
Example
local code = LibStub("LibDogTag-3.0"):ColorizeCode("[Name] [5 + 17]")

