PitBull Unit Frames 4.0

Module:AddFrameScriptHook(script, method, func)

Add a script hook for the unit frames.

Parameters

script
name of the script
method
func
function to call or method on the module to call

Usage

MyModule:AddFrameScriptHook("OnEnter", function(frame)
    -- do stuff here
end)


Module:Clear(frame, return_changed)

Clear the frame for the current module for the given frame and handle any layout changes.

Parameters

frame
the Unit Frame to clear
return_changed
whether to return if the clear should change the layout. If this is false, it will call :UpdateLayout() automatically.

Return value

whether the clear requires UpdateLayout to be called if return_changed is specified

Usage

MyModule:Clear(frame)


Module:GetLayoutDB(layout)

Get the database table for the given layout relating to the current module.

Parameters

layout
either the frame currently being worked on or the name of the layout.

Return value

the database table

Usage

local color = MyModule:GetLayoutDB(frame).color


Module:RemoveFrameScriptHook(script)

Remove a script hook for the unit frames.

Parameters

script
name of the script

Usage

MyModule:RemoveFrameScriptHook("OnEnter")


Module:SetDefaults(layout_defaults, global_defaults)

Set the module's database defaults.
This will cause module.db to be set.

Parameters

layout_defaults
defaults on a per-layout basis. can be nil.
global_defaults
defaults on a per-profile basis. can be nil.

Usage

MyModule:SetDefaults({ color = { 1, 0, 0, 1 } })
MyModule:SetDefaults({ color = { 1, 0, 0, 1 } }, {})


Module:SetDescription(description)

Set the localized description of the module.

Parameters

description
the localized description of the module, as a full sentence, including a period at the end.

Usage

MyModule:SetDescription("This does a lot of things.")


Module:SetModuleType(type)

Set the module type of the module.
This should be called right after creating the module.

Parameters

type
one of "custom", "bar", or "indicator"

Usage

MyModule:SetModuleType("bar")


Module:SetName(name)

Set the localized name of the module.

Parameters

name
the localized name of the module, with proper spacing, and in Title Case.

Usage

MyModule:SetName("My Module")


Module:Update(frame, return_changed, same_guid)

Update the frame for the current module for the given frame and handle any layout changes.

Parameters

frame
the Unit Frame to update
return_changed
whether to return if the update should change the layout. If this is false, it will call :UpdateLayout() automatically.
same_guid
whether when called from :UpdateGUID, the unit is the same GUID as before.

Return value

whether the update requires UpdateLayout to be called if return_changed is specified

Usage

MyModule:Update(frame)


Module:UpdateAll()

Run :Update(frame) on all shown frames.

Usage

MyModule:UpdateAll()


Module:UpdateForClassification(classification)

Run :Update(frame) on all shown frames with the given classification.

Parameters

classification
the classification in question to update

Usage

MyModule:UpdateForClassification("player")


Module:UpdateForGUID(guid)

Run :Update(frame) on all shown frames with the given GUID.

Parameters

guid
the GUID in question to update

Usage

MyModule:UpdateForGUID(UnitGUID("player"))


Module:UpdateForUnitID(unit)

Run :Update(frame) on all shown frames with the given UnitID.

Parameters

unit
the UnitID in question to update

Usage

MyModule:UpdateForUnitID("player")


Module:UpdateNonWacky()

Run :Update(frame) on all non-wacky shown frames.

Usage

MyModule:UpdateNonWacky()


PitBull4:DisableModuleAndSaveState(module)

Disable a module properly.
Unlike module:Disable(), this tracks it in the DB as well as cleans up any frames.

Parameters

module
the module to disable

Usage

PitBull4:DisableModuleAndSaveState(MyModule)


PitBull4:EnableModuleAndSaveState(module)

Enable a module properly.
Unlike module:Enable(), this tracks it in the DB as well as updates any frames.

Parameters

module
the module to enable

Usage

PitBull4:EnableModuleAndSaveState(MyModule)


PitBull4:IterateEnabledModules()

Iterate over all enabled modules

Return value

iterator which returns the id and module

Usage

for id, module in PitBull4:IterateEnabledModules() do
    doSomethingWith(module)
end


PitBull4:IterateFrameScriptHooks(script)

Iterate through all script hooks for a given script

Parameters

script
name of the script

Return value

iterator that returns module and function

Usage

for module, func in PitBull4:IterateFrameScriptHooks("OnEnter") do
    -- do stuff here
end


PitBull4:IterateModulesOfType(...)

Iterate over all modules of a given type.
Only enabled modules will be returned unless true is provided as the last argument

Parameters

...
a tuple of module types, e.g. "bar", "indicator". If the last argument is true, then iterate over disabled modules also

Return value

iterator which returns the id and module

Usage

for id, module in PitBull4:IterateModulesOfType("bar") do
    doSomethingWith(module)
end
for id, module in PitBull4:IterateModulesOfType("bar", "indicator", true) do
    doSomethingWith(module)
end


PitBull4:NewModuleType(name, defaults, update_texts)

Add a new module type.

Parameters

name
name of the module type
defaults
a dictionary of default values that all modules will have that inherit from this module type
update_texts
if texts on the frame should be updated along with :UpdateLayout

Usage

MyModule:NewModuleType("mytype", { size = 50, verbosity = "lots" })


PitBull4:RunFrameScriptHooks(script, frame, ...)

Run all script hooks for a given script

Parameters

script
name of the script
frame
current Unit Frame
...
any arguments to pass in

Usage

PitBull4:RunFrameScriptHooks(script, ...)


You must login to post a comment. Don't have an account? Register to get one!