Download
(6 Kb)
Download
Updated: 08/23/21 08:13 AM
Pictures
File Info
Updated:08/23/21 08:13 AM
Created:03/13/19 02:33 AM
Monthly downloads:3,028
Total downloads:912,239
Favorites:437
MD5:
LibPhinixFunctions  Popular! (More than 5000 hits)
Version: 16
by: Phinix [More]
LibPhinixFunctions


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 first add it to your addon manifest:
## DependsOn: LibPhinixFunctions>=9

Then define it somewhere in your addon where you want to use it:
local PF = LibPhinixFunctions

Functions can them be called like so:
(Here 'color' and 'text' would be value you pass the function. See below for more info.)
PF.TColor(color, text)


Chat commands:

/pfdebug on -Enables debug text output.

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



CURRENT AVAILABLE FUNCTIONS:


PF.SubExtendedASCII(iString) --Convert accented letters to standard ASCII equivalent using extended ASCII lookup table.

Warning: Spoiler

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.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!




Gold donations are always welcome!
PC NA: @IllusoryID



Click here to view my other addons.
Version 16:
- Updated API for Waking Flame update.

Version 15:
- Updated API and version number to Blackwood.
- Removed unnecessary language format code (duplicate of ZOS function).
- Minor code maintenance.

Version 14:
- Updated API for Flames of Ambition.

Version 13:
- Updated API for Stonethorn.

Version 12:
- Slightly modified extended ASCII looking to account for the game treating non-standard ASCII as punctuation and thus stripping letter from non-English clients when using LUA string functions like gsub('%p','') etc.

Version 11:
- Added new function 'SubExtendedASCII' which will accept an input string and return it with extended ASCII accented characters replaced with standard ASCII non-accented equivalents.
- Updated API version for Greymoor.

Version 10:
- Incremented version to avoid possible issues with other versions floating around.

Version 9:
- Updated API for Harrowstorm.
- Properly converted library to not require LibStub.
- Removed deprecated functions & did some maintenance.

Version 8:
- Updated API for Dragonhold.

Version 7:
- Updated API for Scalebreaker.

Version 6:
- API bump for Elsweyr and properly classified as library in manifest.

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 04/19/22, 03:15 PM  
Phinix
 
Phinix's Avatar
AddOn Author - Click to view AddOns

Forum posts: 186
File comments: 1779
Uploads: 32
@HowellQagan - Wow, you really went the extra mile to make this happen. Thanks so much! <3
Report comment to moderator  
Reply With Quote
Unread 04/19/22, 02:14 PM  
HowellQagan
 
HowellQagan's Avatar

Forum posts: 11
File comments: 437
Uploads: 0
Originally Posted by Phinix
Which is to say, I'll look forward to it.
Okay, opened a support ticket in the morning, had to clarify in the afternoon but in the end "Alex" enabled gifting so no 1-month waiting necessary.
Report comment to moderator  
Reply With Quote
Unread 04/18/22, 03:51 PM  
Phinix
 
Phinix's Avatar
AddOn Author - Click to view AddOns

Forum posts: 186
File comments: 1779
Uploads: 32
@HowellQagan - Wow that's a little annoying. I appreciate your willingness to go through all the hassle. I will imagine Giladil is on a boat back from her ragpicking excursions abroad, and ETA a month or so she'll be back for many ragpicking adventures back on Tamriel.

Which is to say, I'll look forward to it.
Last edited by Phinix : 04/18/22 at 03:51 PM.
Report comment to moderator  
Reply With Quote
Unread 04/18/22, 02:47 PM  
HowellQagan
 
HowellQagan's Avatar

Forum posts: 11
File comments: 437
Uploads: 0
Originally Posted by Phinix
@HowellQagan - So long as it is removed in a clean way there should be no consequences to addons that were using it.
Nice, thanks.

Originally Posted by Phinix
Also, still don't have Giladil, but would love her on my travels.
Well... it turns out that it tracks the gifting eligibility not per account but per server... ZOS be fkin weird sometimes with their logic. Never made any characters on NA so now I have to wait 30 days to be able to gift... ggwp
Report comment to moderator  
Reply With Quote
Unread 04/18/22, 02:06 PM  
Phinix
 
Phinix's Avatar
AddOn Author - Click to view AddOns

Forum posts: 186
File comments: 1779
Uploads: 32
@HowellQagan - So long as it is removed in a clean way there should be no consequences to addons that were using it. For example, I have removed this dependency from most of my addons (to reduce lib clutter), by adding the functions they use from this lib directly to those addons. In most cases I add them to each addon's global space. For example for in EZReport, I add them in EZMaint.lua as EZReport.TColor, etc. Since EZMaint loads before all other files that use these functions according to the manifest .txt load order, the addon knows where to find them. You just have to then change any instance of "local pTC = LibPhinixFunctions.TColor" to "local pTC = EZReport.Tcolor" or whatever you localize the functions to.

Hope that helps! Also, still don't have Giladil, but would love her on my travels.
Last edited by Phinix : 04/18/22 at 02:07 PM.
Report comment to moderator  
Reply With Quote
Unread 04/18/22, 01:42 PM  
HowellQagan
 
HowellQagan's Avatar

Forum posts: 11
File comments: 437
Uploads: 0
Heya,

Two questions:
  1. what happens to this if dependency is removed from addons using it?
  2. has anyone gifted Giladil yet? I'm on PC EU but I think crowns are shared so if I made a character there, I could probably gift it.
Report comment to moderator  
Reply With Quote
Unread 07/29/21, 12:53 PM  
AngryNord

Forum posts: 3
File comments: 19
Uploads: 0
Re: Re: Re: Re: Errors...

Originally Posted by Phinix
Originally Posted by AngryNord
Anyone else keep getting constant UI errors with the latest version of this, to the point of making the game unplayable? Disappeared again after removing this add-on + Master Recipe List which was the only addon I had that depend on this
A redundant language formatting function was removed from this library in the last update, and the code of several of my other addons has been changed where they previously used it.

If you updated this library but are still using old versions my other addons (Master Recipe List for example), then it will generate errors as it is attempting to use the function that was removed.

The solution is to ensure all your addons are up to date as this has been resolved in the latest versions of all my addons. I highly recommend downloading Minion (the official esoui.com addon manager) which will let you update all your installed addons easily with the push of a button.

Otherwise it is easy to miss some of them and situations like this can and do emerge from time to time.
Yes, looks like I had overlooked the update to Master Recipe, I had the 1.56.59 version
Last edited by AngryNord : 07/29/21 at 01:49 PM.
Report comment to moderator  
Reply With Quote
Unread 07/29/21, 12:17 PM  
Phinix
 
Phinix's Avatar
AddOn Author - Click to view AddOns

Forum posts: 186
File comments: 1779
Uploads: 32
Re: Re: Re: Errors...

Originally Posted by AngryNord
Anyone else keep getting constant UI errors with the latest version of this, to the point of making the game unplayable? Disappeared again after removing this add-on + Master Recipe List which was the only addon I had that depend on this
A redundant language formatting function was removed from this library in the last update, and the code of several of my other addons has been changed where they previously used it.

If you updated this library but are still using old versions my other addons (Master Recipe List for example), then it will generate errors as it is attempting to use the function that was removed.

The solution is to ensure all your addons are up to date as this has been resolved in the latest versions of all my addons. I highly recommend downloading Minion (the official esoui.com addon manager) which will let you update all your installed addons easily with the push of a button.

Otherwise it is easy to miss some of them and situations like this can and do emerge from time to time.
Last edited by Phinix : 07/29/21 at 12:18 PM.
Report comment to moderator  
Reply With Quote
Unread 07/29/21, 12:12 PM  
Anceane
 
Anceane's Avatar
AddOn Author - Click to view AddOns

Forum posts: 306
File comments: 1017
Uploads: 1
Re: Re: Re: Errors...

Originally Posted by AngryNord
Anyone else keep getting constant UI errors with the latest version of this, to the point of making the game unplayable? Disappeared again after removing this add-on + Master Recipe List which was the only addon I had that depend on this
Would be probably better if you explain or post which errors you have
Report comment to moderator  
Reply With Quote
Unread 07/29/21, 11:03 AM  
AngryNord

Forum posts: 3
File comments: 19
Uploads: 0
Re: Re: Errors...

Anyone else keep getting constant UI errors with the latest version of this, to the point of making the game unplayable? Disappeared again after removing this add-on + Master Recipe List which was the only addon I had that depend on this
Last edited by AngryNord : 07/29/21 at 11:35 AM.
Report comment to moderator  
Reply With Quote
Unread 03/28/20, 02:07 AM  
Phinix
 
Phinix's Avatar
AddOn Author - Click to view AddOns

Forum posts: 186
File comments: 1779
Uploads: 32
Re: Errors...

Originally Posted by Shadowshire
Originally Posted by Baertram
Version 9 with LibStub support but also with global variable
LibPhinixFunctions
-> SavedVariables were renamed to LibPhinixFunctions_SV
Both ESO Master Recipe List and SALTI use LibPhinixFunctions -- and respective UI errors are displayed for each of the two add-ons immediately after the character appears on the HUD. The .../Saved Variables folder currently contains a file named LibPhinixFunctions.lua. It does not contain one named LibPhinixFunctions_SV. Please advise.
I just re-uploaded after incrementing the version number to 10, which should override any other versions out there.

I looked at Baertram's fix he made while I was AFK from modding and it doesn't seem like it should cause problems, but still being dependent on LibStub is asking for compatibility trouble.

The new version I just uploaded does not require LibStub. Please let me know if you still experience errors after updating.
Last edited by Phinix : 03/28/20 at 12:43 PM.
Report comment to moderator  
Reply With Quote
Unread 03/17/19, 04:59 PM  
Baertram
Super Moderator
 
Baertram's Avatar
ESOUI Super Moderator
AddOn Author - Click to view AddOns

Forum posts: 4912
File comments: 5990
Uploads: 78
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: 186
File comments: 1779
Uploads: 32
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
Super Moderator
 
Baertram's Avatar
ESOUI Super Moderator
AddOn Author - Click to view AddOns

Forum posts: 4912
File comments: 5990
Uploads: 78
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: