Mercurial > wow > mylilpony
diff libMyLilPony/libMyLilPony_miscFunctions.lua @ 7:d96c15f7477b
Updated documentation for API.
author | syzler |
---|---|
date | Tue, 05 Apr 2011 02:05:57 +0000 |
parents | 7dfbf42c2d60 |
children | b1e344c17ab5 |
line wrap: on
line diff
--- a/libMyLilPony/libMyLilPony_miscFunctions.lua Tue Apr 05 01:11:23 2011 +0000 +++ b/libMyLilPony/libMyLilPony_miscFunctions.lua Tue Apr 05 02:05:57 2011 +0000 @@ -16,8 +16,10 @@ -- Misc helper functions used in the library +--- Gets a hashtable of buffs on the specified unit. +-- @param unit The unit frame name (e.g. "target", "player", "focus") of the unit whose buffs are to be retrieved. +-- @returns a hashtable of buff spell IDs keyed on the ID. function MyLilPony.GetUnitBuffs(unit) - -- build a hashtable of buffs on the unit local buffs = {}; for i = 1, 40 do local _, _, _, _, _, _, _, _, _, _, id = UnitAura(unit, i, "HELPFUL"); @@ -28,6 +30,10 @@ return buffs; end +--- Performs case-insensitive string pattern matching. +-- @param subject The string on which the pattern matching is performed. +-- @param pattern The pattern to be matched. +-- @returns The match result captures, the entire string if there are no captures, or nil if the subject is not a match. function MyLilPony.StringMatchIgnoreCase(subject, pattern) if subject == nil and pattern == nil then return true end if subject == nil or pattern == nil then return false end @@ -36,12 +42,19 @@ return string.match(lSub, lPat); end +--- Calls a companion if a specified condition checks out. +-- @param companionType The type of companion to be called (e.g. "MOUNT"). +-- @param companionNumber The slot number of the companion to be called. +-- @param condition An optional Boolean condition. function MyLilPony.CallCompanion(companionType, companionNumber, condition) if condition == nil or condition then CallCompanion(companionType, companionNumber); end end +--- Gets a value indicating whether or not the current character is able to fly at the current location. +-- This function checks whether or not the current location is a flyable area, and then additionally checks for knowledge of the proper flying skill (e.g. Cold Weather Flying for Northrend). +-- @returns A Boolean value indicating whether or not the current character is able to fly at the current location. function MyLilPony.CanFlyHere() if IsFlyableArea() then SetMapToCurrentZone();