LibSharedAssets

Using LibSharedAssets

First, make sure both LibStub.lua and LibSharedAssets.lua are include in your own addon's <Files> section in the .mod (you'll want to copy them into your addon's folder, as well - it's fine to distribute them with your addon). Place them before the rest of your addon's files so that they'll be available when loading the other files.

In your Lua file where you wish to use LibSharedAssets, get an instance of it like this:

local LibSA = LibStub("LibSharedAssets")

You can then use this LibSA object (or whatever you choose to name it) to call the various methods made available.

Addons that utilize textures

Your main usage will be LibSA:GetTextureList() which allows you to get lists of names for various textures that have been registered with LibSharedAssets. You may also want to use LibSA:GetMetadata() to get more information (if any exists) about a specific texture.

See the API documentation for information about the arguments and return values for both functions.

It is highly recommended that you wait until all addons have been loaded (typically, until the first LOADING_END event) to request texture lists and apply textures, instead of processing them during OnInitialize, since a texture pack addon may not load fully until your addon has already been initialized.

Addons that provide textures

LibSA:RegisterTexture() allows any addon to register textures with LibSharedAssets (the addon itself is responsible for loading the texture in question from an XML texture tag). See the API documentation for information about the arguments and return values for this function.

You must login to post a comment. Don't have an account? Register to get one!

Facts

Date created
08 Jan 2009
Last updated
08 Jan 2009

Author