-
Notifications
You must be signed in to change notification settings - Fork 0
Getting Started
Install LibSFUtils like any other ESO addon.
If your addon depends on LibSFUtils, list it in your addon's manifest (.txt) file.
## DependsOn: LibSFUtilsor
## OptionalDependsOn: LibSFUtilsif your addon can function without it.
The library is available through the global variable:
local SF = LibSFUtilsMost examples in this documentation assume this alias.
LibSFUtils is organized into small, focused modules.
For example:
| Module | Purpose |
|---|---|
| Addon Chatter & Slash Help | Centralize addon chat message and commands |
| Predefined Colors | Predefine commonly used colors to prevent extraneous processing |
| Miscellaneous Utility Functions | Functions to simplify common Lua tasks |
| String utilities | Formatting and text manipulation |
| Color utilities | Color creation; text and icon colorization |
| Table utilities | Searching, copying, and merging tables |
Logger |
Debug and diagnostic output |
EventManager |
Centralized management of ESO events |
CallLater |
Delayed and periodic timers |
HookManager |
Centralized management of ESO hooks |
VersionChecker |
Compare addon versions and compatibility |
Queue |
FIFO queue implementation |
TimedQueue |
Queue with delayed processing |
Each module has its own documentation page with complete API details and examples.
The simplest way to execute code after a short delay is with CallLater.
local SF = LibSFUtils
SF.CallLater:New(function()
d("Hello, Tamriel!")
end, 1000):Start()This creates a one-shot timer that executes once after one second.
To execute code whenever an ESO function runs:
local SF = LibSFUtils
local hooks = SF.HookManager:New()
hooks:PostHook(ZO_PlayerInventory, "RefreshInventory", function()
d("Inventory refreshed.")
end)The hook is registered immediately and will execute every time the inventory refreshes.
When executing user callbacks or potentially unsafe code, use safeCall.
local ok, result = SF.safeCall(function()
-- risky code
end)
if not ok then
d("Callback failed.")
endThis prevents Lua errors from propagating through the game UI.
| If you want to... | Use... |
|---|---|
| Run code later | CallLater |
| Repeat a task | CallLater:NewTimer() |
| Hook an ESO function | HookManager |
| Safely execute callbacks | safeCall |
| Compare addon versions | VersionChecker |
| Manage queued work |
Queue or TimedQueue
|
| Write debug output | Logger |
Each module in LibSFUtils follows a consistent documentation format:
- Overview
- Constructors
- Public API
- Examples
- Notes
- API Reference
Once you understand one module, the others should feel familiar.