LibAlts-1.0

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/

Facts

Date created
Oct 21, 2008
Categories
Last update
Nov 29, 2011
Development stage
Mature
License
MIT License
Curse link
LibAlts-1.0
Reverse relationships
6
Downloads
89,385
Recent files
  • R: 2.0 for 4.3 Nov 29, 2011
  • A: r46 for 4.3 Nov 29, 2011
  • R: 1.9 for 4.2 Jun 28, 2011
  • A: r44 for 4.2 Jun 28, 2011
  • R: 1.8 for 4.0.6 Apr 26, 2011

Authors

Relationships

Embedded library
CallbackHandler-1.0
LibStub