promotional bannermobile promotional banner
header

LibAlts-1.0 will start downloading in 5 seconds...

STILL DOWNLOADING MANUALLY??

Join over 10 million players who use the CurseForge app!

Download App Now

Description

Overview

LibAlts provides an API to register and retrieve alternate identity information between addons. It maintains main-alt relationships. A given character can be defined as a main with one or more alts.

Basic API

  • :SetAlt(main, alt, source) - Associate a main name with an alt name. An optional source can be specified. If no source is specified, it is added the user-defined source.
  • :GetAlts(main) - Get a list of alts for a given name.
  • :GetMain(alt) - Get the main character associated with a given name.
  • :GetAllMains() - Get a list of all main characters.
  • :IsMain(main) - Is the given name a main character.
  • :IsAlt(alt) - Is the given name an alternate character.
  • :DeleteAlt(main, alt, source) - Delete the main-alt relationship. An optional source can be specified. If no source is specified, it is deleted from the user-defined source.
  • :TitleCase(name) - Return the name in title case. The first letter is capitalized and the rest are lower case.

Sources

Sources are a way to differentiate the data entered into LibAlts. User-defined data will have no source (i.e., the source is nil). Sources provide a solution to problems such as automated guild imports. If the information pushed into LibAlts from guild notes is placed into the same area as user-defined notes, then re-importing it later is problematic. If the guild data has its own area, it is easy to wipe that data and re-import it.

When adding data from automated sources, the source name needs to be unique. As a convention, data added for a guild should have the GUILD_PREFIX constant prepended to the guild name returned from the GetGuildInfo() API call. Data from an addon should have the ADDON_PREFIX prepended to the addon name.

LibAlts will merge data from all sources when answering queries, unless you use one of the *ForSource functions that allows you to query a particular source.

  • :GetAltsForSource(main, source) - Get a list of alts for a given name for the given source.
  • :GetMainForSource(alt, source) - Get the main character associated with a given name for the given source.
  • :GetAllMains(source) - Get a list of all main characters for the given source.
  • :IsMainForSource(main, source) - Is the given name a main character.
  • :IsAltForSource(alt, source) - Is the given name an alternate character.
  • :RemoveSource(source) - Remove all data for the given source.
  • GUILD_PREFIX - A constant to prepend to source names for imported guild data.
  • ADDON_PREFIX - A constant to prepend to source names for addon automated data.

Callbacks

  • LibAlts_SetAlt - Fired after SetAlt() is called.
  • LibAlts_RemoveAlt - Fired after DelAlt() is called
  • LibAlts_RemoveSource - Fired after RemoveSource() is called.

LuaDoc: http://www.wowace.com/projects/libalts-1-0/pages/api/lib-alts-1-0/