LibTSMUtil provides many general utility functions and classes that have proven helpful when writing complex WoW addons.
See the docs for complete documentation and usage.
This library has the following external dependencies which must be installed separately within the target application:
It also embeds two libraries: LibDeflate and LibSerialize.
If you're using the BigWigs packager, you can reference LibTSMUtil as an external library.
externals:
Libs/LibTSMUtil:
url: https://github.com/TradeSkillMaster/LibTSMUtil.gitOtherwise, you can download the latest release directly from GitHub.
To use LibTSMUtil, add LibTSMUtil.xml to your .toc (or equivalent XML) and the LibTSMUtil
component will be made available via LibTSMCore.
-- App/Core.lua
local ADDON_TABLE = select(2, ...)
ADDON_TABLE.App = ADDON_TABLE.LibTSMCore.NewComponent("App")
:AddDependency("LibTSMUtil")You can then access the various modules and classes within LibTSMUtil.
-- App/UI.lua
local App = select(2, ...).App
local UI = App:Init("UI")
local String = App:From("LibTSMUtil"):Include("Lua.String")
local Log = App:From("LibTSMUtil"):Include("Util.Log")
local SAVED_CHARACTERS_SEP = ","
local private = {
characters = {}
}
function UI.LoadSavedCharacters(settingsStr)
String.SafeSplit(settingsStr, SAVED_CHARACTERS_SEP, private.characters)
for _, character in ipairs(private.characters) do
Log.Info("Loaded character: %s", character)
end
endThe features of LibTSMUtil are split across a few different modules:
Luacontains extensions on the various built-in Lua libraries and data typesBaseTypecontains general utility classes and data typesUtilcontains additional classes and modules which don't fit nicely into one of other modulesFormatcontains modules for formatting and encoding data into a variety of string formatsUIcontains some UI-related utility classes and modulesFSMcontains a finite state machine implementation
LibTSMUtil is licensed under the MIT license. See LICENSE.txt for more information. If you would like to contribute to LibTSMUtil, opening an issue or submitting a pull request against the LibTSMUtil GitHub project is highly encouraged.