Go to Page... |
Compatibility: | Necrom (9.0.0) Scribes of Fate (8.3.5) Firesong (8.2.5) Lost Depths (8.1.5) High Isle (8.0.0) |
Updated: | 05/25/23 09:53 PM |
Created: | 12/30/18 04:39 PM |
Monthly downloads: | 47,490 |
Total downloads: | 837,899 |
Favorites: | 247 |
MD5: |
Concatenate varargs to a string. Uses table concatenation to combine the parameters to be slightly more efficient to multiple uses of the .. string concatenator.function LibSFUtils.dstr(delim, ...)
Concatenate varargs to a delimited string. Uses table concatenation to combine the parameters separated by the specified delimiter to be slightly more efficient to multiple uses of the .. string concatenator.function LibSFUtils.GetIconized(prompt, promptcolor, texturefile, texturecolor)
Create a string containing an optional icon (of optional color) followed by a text prompt. (Without the parameters, it simply prepares and optionally colorizes text.)function LibSFUtils.ColorText(prompt, promptcolor)
The prompt parameter is a string or a localization string id.
The color parameters are all hex colors.
Create a string containing a text prompt and a text color. The text color is optional, but if you do not provide it, you just get the same text back that you put in.function LibSFUtils.bool2str(bool)
The prompt parameter is a string or a localization string id.
The color parameter is a hex color.
Turn a boolean value into a string suitable for display. Returns the string "true" or "false".
This function uses LibSFUtils.isTrue() to decide if bool is true - which will have different results from the lua standard definition of "true". Lua decides that anything not false (or nil) must be true (including 0). This function decides that anything not true (or 1) is false.
Used to be able to wrap an existing function with another so that subsequent calls to the function will actually invoke the wrapping function.
The wrapping function should accept a function as the first parameter, followed by the parameters expected by the original function. It will be passed in the original function so the wrapping function can call it (if it chooses).
Can be called with or without the namespace parameter (which defines the namespace where the original function is defined). If the namespace parameter is not provided then assume the global namespace _G.
Examples:
WrapFunction(myfunc, mywrapper)
will wrap the global function myfunc to call mywrapper
WrapFunction(TT, myfunc, mywrapper)
will wrap TT.myfunc with a call to mywrapper
Get saved variables table toon only. In addition to calling the appropriate ZO_SavedVars function, it will call LibSFUtils.defaultMissing().function LibSFUtils.getAcctSavedVars(saveFile, saveVer, saveDefaults)
Note: This does NOT automatically add an accountWide variable to the table if it is not already there!
Get saved variables table account-wide only. In addition to calling the appropriate ZO_SavedVars function, it will call LibSFUtils.defaultMissing().function LibSFUtils.getAllSavedVars(saveFileName, saveVer, saveAWDefaults, saveToonDefaults)
Get saved variables tables when we deal with both toon and account-wide settings.function LibSFUtils.currentSavedVars(aw, toon, newAcctWideVal)
Toon and account-wide can have different default tables (but don't have to). If you only specify one default table it will be used for both account-wide and toon.
An "accountWide" variable will be automatically added to the toon table if it does not already exist, because the currentSavedVars() function works off of that. It is used to designate whether the settings for account-wide are currently in effect or the toon settings are in effect.
Return the currently active table of saved variables.function LibSFUtils.defaultMissing(svtable, defaulttable)
If newAcctWideVal is not nil, then the toon.accountWide value will be set to the new value before deciding which of the tables aw or toon will be returned (based on if toon.accountWide evaluates to true or false).
Recursively initialize missing values in a table from a defaults table. Existing values in the svtable will remain unchanged. This function is needed because the ZO_SavedVars functions do not recurse into a table inside the defaulttable if the table itself exists in svtable.
Returns true if val was some value equivalent to true or 1. Any other value will return false.function LibSFUtils.nilDefault( val, defaultval )
(This is different from the lua standard definition of "true". Lua decides that anything not false (or nil) must be true (including 0).
This function decides that anything not true (or 1) is false.)
Return the value of val; unless it is nil when we then will return defaultval instead of the nil.
The lua standard "var = val or default" does not do the same job, because if val evaluates to false according to lua then the default value would still be assigned.
Here we specifically only want the default value if val == nil.
Create a prefix to use in front of your messages (so that users can tell your messages from some other addon's). (If you are not using addonChatter.)function LibSFUtils.systemMsg(prefix, text, hexcolor)
Send a message to the chat window prefixed by the prefix that you pass in.function LibSFUtils.addonChatter:New(addon_name)
Create an addonChatter table and set up the prefix to use in front of your messages (so that users can tell your messages from some other addon's messages).function LibSFUtils.addonChatter:systemMessage(...)
Print normal messages to chatfunction LibSFUtils.addonChatter:debugMsg(...)
Print debug messages to chat if debug messages are enabled.function LibSFUtils.addonChatter:enableDebug()
Turn on the printing of debug messages.function LibSFUtils.addonChatter:disableDebug()
Turn off the printing of debug messages.function LibSFUtils.addonChatter:toggleDebug()
Toggle on/off the printing of debug messagesfunction LibSFUtils.addonChatter:getDebugState()
Return the string "true" if debug messages are enabled. Otherwise return the string "false".
Display in chat a table of slash commands with descriptions (using the addonChatter you have previously created)Localization
Add strings to the string table for the client language (or the default language if the client language did not have strings defined for it). The localization_strings parameter is a table of tables of localization strings, and defaultLang defaults to "en" if not provided.Version Checker
For example: You could have the following string table defined:
local localization_strings = {}
de = {
AC_IAKONI_TAG= "Iakoni's Gear Changer",
AC_IAKONI_CATEGORY_SET_1= "Set#1",
AC_IAKONI_CATEGORY_SET_1_DESC= "#1 Set aus dem AddOn Iakoni's Gear Changer",
AC_IAKONI_CATEGORY_SET_2= "Set#2",
AC_IAKONI_CATEGORY_SET_2_DESC= "#2 Set aus dem AddOn Iakoni's Gear Changer",
AC_IAKONI_CATEGORY_SET_3= "Set#3",
AC_IAKONI_CATEGORY_SET_3_DESC= "#3 Set aus dem AddOn Iakoni's Gear Changer",
},
en = {
AC_IAKONI_TAG= "Iakoni's Gear Changer",
AC_IAKONI_CATEGORY_SET_1= "Set#1",
AC_IAKONI_CATEGORY_SET_1_DESC= "#1 Set from Iakoni's Gear Changer",
AC_IAKONI_CATEGORY_SET_2= "Set#2",
AC_IAKONI_CATEGORY_SET_2_DESC= "#2 Set from Iakoni's Gear Changer",
AC_IAKONI_CATEGORY_SET_3= "Set#3",
AC_IAKONI_CATEGORY_SET_3_DESC= "#3 Set from Iakoni's Gear Changer",
},
zh = {
AC_IAKONI_TAG= "Iakoni's Gear Changer",
AC_IAKONI_CATEGORY_SET_1= "装备配置#1",
AC_IAKONI_CATEGORY_SET_1_DESC= "#1 号装备配置 Iakoni's Gear Changer",
AC_IAKONI_CATEGORY_SET_2= "装备配置#2",
AC_IAKONI_CATEGORY_SET_2_DESC= "#2 号装备配置 Iakoni's Gear Changer",
AC_IAKONI_CATEGORY_SET_3= "装备配置#3",
AC_IAKONI_CATEGORY_SET_3_DESC= "#3 号装备配置 Iakoni's Gear Changer",
},
and then in your initialization function call:
LibSFUtils.LoadLanguage(localization_strings,"en")or you can split the definitions ofAC_localization_strings["en"], AC_localization_strings["de"], and AC_localization_strings["zh"]into separate files (strings.lua for the default, de.lua, zh.lua, etc) and then include your default language lua file (strings.lua), and $(language).lua in your addon manifest. This way you can only load the strings for two languages (at most) instead of all of them you have available.
## AddOnVersion: 23
<mylogger>:Error(<format>,...)
<mylogger>:Warn(<format>,...)
<mylogger>:Info(<format>,...)
local VC = LibSFUtils.VersionChecker
Create a new instance of a version checker.function VC:Enable(logger)
Enable the VersionChecker instance and set the logger that the instance is to use.function VC.Disable(self)
For instance, you would call.Code:myVC:Enable(LibDebugLogger("myAddon"))
Disable the VersionChecker instance so that none of the other VC functions do anything.function VC:NewCheckVersion(libname, expectedVersion)
Check if the library is 1) loaded, and 2) has a version that is equal to or greater than the version you expect to have.function VC:NoVersion(libname)
Specify that you know that no version information is available for the library - (only an info message).function LibSFUtils.GetAddonIndex(libname)
This utility function will return the ZOS addon index for the library named libname (if it is loaded). If it is not loaded, it will return -1.function LibSFUtils.GetAddonVersion(name)
This utility function will return the addon version (as specified in the manifest ##AddOnVersion: line) for the library named libname (if it is loaded). If it is not loaded, it will return -1. If it is loaded but does not have a ##AddOnVersion: then it will return 0.Example of use:
function myaddon.checkLibraryVersions() local vc = LibSFUtils.VersionChecker("myaddon") local logger = LibDebugLogger.Create("rChat") vc:Enable(logger) vc:CheckVersion("LibAddonMenu-2.0", 30) vc:CheckVersion("LibMediaProvider-1.0", 12) vc:CheckVersion("libChat2", 12) vc:CheckVersion("LibSFUtils", 23) vc:CheckVersion("LibDebugLogger",128) end local function OnAddonLoaded(_, addonName) --Protect if addonName ~= myaddon.name then return end myaddon.checkLibraryVersions() -- do important stuff end
local SF = LibStub("LibSFUtils")
local SF = LibSFUtils
chatter:slashHelp("my title", { { "/xx.init", "Reinitialize"}, {"/xx cute", "Display cute remark"} } )
[myaddon] my titlein the chat window.
[myaddon] /xx.init = Reinitialize
[myaddon] /xx cute = Display cute remark
File Name |
Version |
Size |
Uploader |
Date |
44 |
26kB |
Shadowfen |
05/03/23 02:43 PM |
|
43 |
25kB |
Shadowfen |
03/12/23 07:12 PM |
|
42 |
25kB |
Shadowfen |
10/30/22 04:27 PM |
|
41 |
25kB |
Shadowfen |
06/05/22 05:41 PM |
|
40 |
26kB |
Shadowfen |
03/12/22 03:16 PM |
|
39 |
25kB |
Shadowfen |
01/17/22 11:12 PM |
|
38 |
25kB |
Shadowfen |
12/05/21 01:08 AM |
|
36 |
22kB |
Shadowfen |
11/04/21 08:53 PM |
|
35 |
22kB |
Shadowfen |
09/07/21 07:52 PM |
|
34 |
21kB |
Shadowfen |
09/03/21 11:04 AM |
|
33 |
21kB |
Shadowfen |
08/27/21 01:58 PM |
|
31 |
20kB |
Shadowfen |
05/04/21 09:55 PM |
|
30 |
20kB |
Shadowfen |
02/15/21 01:14 AM |
|
29 |
19kB |
Shadowfen |
01/13/21 09:11 PM |
|
28 |
20kB |
Shadowfen |
11/01/20 02:21 PM |
|
27 |
19kB |
Shadowfen |
08/26/20 08:05 PM |
|
26 |
19kB |
Shadowfen |
06/15/20 07:09 PM |
|
25 |
18kB |
Shadowfen |
06/12/20 02:56 PM |
|
24 |
18kB |
Shadowfen |
05/07/20 05:43 PM |
|
23 |
18kB |
Shadowfen |
02/04/20 09:54 PM |
|
22 |
15kB |
Shadowfen |
01/17/20 10:24 AM |
|
21 |
13kB |
Shadowfen |
01/01/20 03:19 PM |
|
20 |
12kB |
Shadowfen |
12/10/19 08:41 PM |
|
19 |
11kB |
Shadowfen |
10/20/19 05:04 PM |
|
18 |
11kB |
Shadowfen |
08/15/19 11:46 PM |
|
17 |
66kB |
Shadowfen |
05/19/19 06:37 PM |
|
16 |
11kB |
Shadowfen |
05/11/19 08:53 AM |
|
15 |
52kB |
Shadowfen |
05/02/19 10:54 PM |
|
14 |
9kB |
Shadowfen |
02/25/19 10:13 PM |
|
13 |
9kB |
Shadowfen |
12/31/18 12:20 PM |
|
12 |
9kB |
Shadowfen |
12/30/18 04:39 PM |
![]() |
Comment Options |
Damolann |
View Public Profile |
Send a private message to Damolann |
Find More Posts by Damolann |
Add Damolann to Your Buddy List |
Shadowfen |
View Public Profile |
Send a private message to Shadowfen |
Send email to Shadowfen |
Find More Posts by Shadowfen |
Add Shadowfen to Your Buddy List |
![]() |
|
Forum posts: 0
File comments: 23
Uploads: 0
|
I actually have completely uninstalled and reinstalled using Minion and i still get the same error. Clearly something isn't right
![]() |
![]() |
![]() |
fostot |
View Public Profile |
Send a private message to fostot |
Send email to fostot |
Find More Posts by fostot |
Add fostot to Your Buddy List |
![]() |
||
|
For Slasher, it is likely that you have an out-of-date LibSFUtils that still requires LibStub (which is no longer provided). For Fast Ride, you should make sure that you have installed LibAddonMenu-2.0 as a separate standalone addon (just install it from Minion). The latest version of that addon is required for this version of FastRide (and the latest version of LibAddonMenu-2.0 is only available separately - it is not included with other Addons now). |
|
![]() |
![]() |
Shadowfen |
View Public Profile |
Send a private message to Shadowfen |
Send email to Shadowfen |
Find More Posts by Shadowfen |
Add Shadowfen to Your Buddy List |
![]() |
|
|
The new version of the lib isn't working for me. Slasher throws an error on login and Fast Ride doesn't activate.
|
![]() |
![]() |
dlrgames |
View Public Profile |
Send a private message to dlrgames |
Send email to dlrgames |
Find More Posts by dlrgames |
Add dlrgames to Your Buddy List |
![]() |
|||
|
Oh right, you are using it already. This changes things a bit
![]()
|
||
![]() |
![]() |
Baertram |
View Public Profile |
Send a private message to Baertram |
Send email to Baertram |
Find More Posts by Baertram |
Add Baertram to Your Buddy List |
![]() |
||
|
Edit: While it might not need LibStub to control which version got loaded, it seems that it is still required until I either change the library's namespace to match what was being passed into LibStub:NewLibrary() or else I change all of the addons which use the library to use the library's real namespace instead of the LibStub string. So, not really a quick change. (Also, it is not a new library - just a newly published library. ![]()
Last edited by Shadowfen : 12/30/18 at 09:05 PM.
|
|
![]() |
![]() |
Shadowfen |
View Public Profile |
Send a private message to Shadowfen |
Send email to Shadowfen |
Find More Posts by Shadowfen |
Add Shadowfen to Your Buddy List |
![]() |
|
|
Hey Shadowfen,
What I heard from other devs (untested): New libraries should not use LibStub anymore but ONLY apply the ##AddOnVersion: tag in the manifest txt file. As you are using "##AddOnVersion" in the manifest txt file of your library you normally do not need to use LibStub anymore. So you could remove the ##DependsOn: LibStub line! You could simply strip it from your library and the game will assure that the ##AddOnVersion given will be loaded with the maximum value (the part which libStub was doing before).
Last edited by Baertram : 12/30/18 at 07:59 PM.
|
![]() |
![]() |
Baertram |
View Public Profile |
Send a private message to Baertram |
Send email to Baertram |
Find More Posts by Baertram |
Add Baertram to Your Buddy List |
![]() |