Quantcast
Channel: ESOUI - AddOns by Phinix
Viewing all articles
Browse latest Browse all 548

LibPhinixFunctions (4)

$
0
0
Change Log:
--------------------
Version 4:
- Minor corrections to the time function.
- Modified RGB2Hex to account for out-of-order rgba table input.

Version 3:
- Added new option to sort by custom LUA table.sort function to GetSorted.

Version 2:
- Changed function notation to avoid potential value mismatches.
- Updated safety checks for nil values and other precautions.
- Updated comments to correct typos and better describe usage scenarios.
- Added current status of debug option to no-option /pfdebug command.

Version 1:
- Initial release.

Description:
--------------------
LibPhinixFunctions

UPDATE: The new gifting system is a great way to keep addon authors interested: Please check the Donate tab!

This simple library consolidates various useful tricks and techniques I have picked up over my years of LUA coding and used in various of my addon projects.
New functions will be included as needed/requested.

To use the library define it in your addon as you normally would, for example:

local PF = LibStub("LibPhinixFunctions")


Chat commands:

/pfdebug on -Enables debug text output.

/pfdebug off -Disables debug text output (default ).



CURRENT AVAILABLE FUNCTIONS:


PF.Hex2RGB(hex) --Gets { r=r, g=g, b=b, a=a } table for LibAddonMenu colopicker from hex color value.

Gets the RGB value needed for LibAddonMenu color picker settings from a hex format variable used in text string coloring.
For example, you have a saved variable such as Addon.ASV.textColor = "ffffff" you use to set text labels: Label:SetText("|c"..Addon.ASV.textColor..SomeText.."|r")
If you want to allow users to pick the color used through LibAddonMenu colorpicker you can make the GetFunc Hex2RGB(textColor):
getFunc = function()
return PF.Hex2RGB(Addon.ASV.textColor)
end,
PF.RGB2Hex(rgb) --Gets hex color format string from LibAddonMenu { r=r, g=g, b=b, a=a } colopicker table.

Works opposite to the above, used for the SetFunc in LibAddonMenu color picker to save the chosen color to a hex variable for use in addons.
setFunc = function(r, g, b, a)
local color = { r=r, g=g, b=b, a=a }
Addon.ASV.textColor = PF.RGB2Hex(color)
end,
[COLOR="Ye...

Viewing all articles
Browse latest Browse all 548

Trending Articles