Quantcast
Download
(5 Kb)
Download
Updated: 03/17/19 04:27 PM
Pictures
File Info
Compatibility:
Wrathstone (4.3)
Updated:03/17/19 04:27 PM
Created:03/13/19 02:33 AM
Monthly downloads:16,446
Total downloads:44,766
Favorites:107
MD5:
LibPhinixFunctions  Popular! (More than 5000 hits)
Version: 5
by: Phinix [More]
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.

Warning: Spoiler

PF.RGB2Hex(rgb) --Gets hex color format string from LibAddonMenu { r=r, g=g, b=b, a=a } colopicker or { [1]=r, [2]=g, [3]=b, [4]=a } saved variable table.

Warning: Spoiler

PF.TColor(color, text) --Wraps the color tags with the passed color around the given text.

Warning: Spoiler

PF.GetItemIdFromLink(itemLink) --Parse an item link for the itemId.

Warning: Spoiler

PF.LangFormat(langText) --ZOS function for removing special characters from names in various languages.

Warning: Spoiler

PF.Contains(nTable, element) --Determined if a given element exists in a given table.

Warning: Spoiler

PF.GetKey(nTable, element, all) --Returns the table key(s) that contains a given element value.

Warning: Spoiler

PF.CountKeys(nTable) --Count the key/value pairs in a hashed table (when #table returns 0).

Warning: Spoiler

PF.Round(number, decimals) --Round number to decimals number of places.

Warning: Spoiler

PF.GetDateTime(t12, dUSA, sepH, nCap) --Generates a custom formatted time/date string (with options).

Warning: Spoiler

PF.GetSorted(sTable, sMode, sFunc) --Returns an indexed table of sorted values based on selection (key/value/sub-value).

Warning: Spoiler



I hope you find some of these shortcuts helpful!


Please read the donate tab!




Click here to view my other addons, or view my Skyrim mods here.
Version 5:
- Added support for both LibAddonMenu { r=r, g=g, b=b, a=a } colopicker or { [1]=r, [2]=g, [3]=b, [4]=a } saved variable table input format to RGB2Hex function.

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.
Post A Reply Comment Options
Unread 03/17/19, 04:59 PM  
Baertram
 
Baertram's Avatar
AddOn Author - Click to view AddOns

Forum posts: 2134
File comments: 2318
Uploads: 56
Yep, sorry have not seen your lib earlier.
This changed about major 2 patches ago I think.
Be sure to only use an integer value as ##AddOnVersion:.
No decimal places!
e.g.
##AddOnVersion: 1
##AddOnVersion: 11 -- version 1.1 in other notation

##AddOnVersion: 1.1 won't load!

Originally Posted by Phinix
Originally Posted by Baertram
Not sure if you knew that but you can stiop using LibStub with new libraries:
You could simply use the games ##AddOnVersion: <signed integer> tag now.
The highest version will be loaded, all other ignored (like LibStub does).
You only need a global variable for your lib defined like LibPhinixFunctions = LibPhinixFunctions or {} to be safe.
Oh, when did that change? Thanks for the info!

The only pain now is I have to go back and change the "local PF = LibStub('LibPhinixFunctions')" to "local PF = LibPhinixFunctions" in about a dozen addons.
Report comment to moderator  
Reply With Quote
Unread 03/17/19, 04:50 PM  
Phinix
 
Phinix's Avatar
AddOn Author - Click to view AddOns

Forum posts: 142
File comments: 1053
Uploads: 29
Originally Posted by Baertram
Not sure if you knew that but you can stiop using LibStub with new libraries:
You could simply use the games ##AddOnVersion: <signed integer> tag now.
The highest version will be loaded, all other ignored (like LibStub does).
You only need a global variable for your lib defined like LibPhinixFunctions = LibPhinixFunctions or {} to be safe.
Oh, when did that change? Thanks for the info!

The only pain now is I have to go back and change the "local PF = LibStub('LibPhinixFunctions')" to "local PF = LibPhinixFunctions" in about a dozen addons.
Last edited by Phinix : 03/17/19 at 04:56 PM.
Report comment to moderator  
Reply With Quote
Unread 03/17/19, 04:38 PM  
Baertram
 
Baertram's Avatar
AddOn Author - Click to view AddOns

Forum posts: 2134
File comments: 2318
Uploads: 56
Not sure if you knew that but you can stiop using LibStub with new libraries:
You could simply use the games ##AddOnVersion: <signed integer> tag now.
The highest version will be loaded, all other ignored (like LibStub does).
You only need a global variable for your lib defined like LibPhinixFunctions = LibPhinixFunctions or {} to be safe.
Report comment to moderator  
Reply With Quote
Post A Reply



Category Jump: