Skip to content

Getting Started

Shadowfen edited this page Jul 30, 2026 · 8 revisions

Installation

Install LibSFUtils like any other ESO addon.

If your addon depends on LibSFUtils, list it in your addon's manifest (.txt) file.

## DependsOn: LibSFUtils

or

## OptionalDependsOn: LibSFUtils

if your addon can function without it.


Accessing the Library

The library is available through the global variable:

local SF = LibSFUtils

Most examples in this documentation assume this alias.


Library Organization

LibSFUtils is organized into small, focused modules.

For example:

Module Purpose
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.


Your First Timer

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.


Your First Hook

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.


Safe Function Calls

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.")
end

This prevents Lua errors from propagating through the game UI.


Finding the Right Tool

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

Documentation Structure

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.

Clone this wiki locally