View Single Post
Unread 08-11-11, 11:32 AM   #1
chrixian
Zombie
Join Date: Aug 2011
Posts: 1
WoW's Global Function Aliases

I posted this on the official addon forum, figure I'd repost here.

I was getting annoyed with random errors anytime I'd use function aliases I was used to having available so I re-created all the global aliases that WoW provides. I figured I'd post it because it could be helpful to anyone porting any addons to Rift. I personally have the code as the first file in my RunOnStartup but you could make a lib out of it and add it as a dependency/embed if you were so inclined.. would probably make it a bit more reusable. shrug. anyway here ya are

Code:
    if not abs then abs = math.abs end
    if not gsub then gsub = string.gsub end
    if not ceil then ceil = math.ceil  end
    if not strbyte then strbyte = string.byte end
    if not cos then cos = math.cos end
    if not strchar then strchar = string.char end
    if not deg then deg = math.deg end
    if not strfind then strfind = string.find end
    if not exp then exp = math.exp end
    if not strlen then strlen = string.len end
    if not floor then floor = math.floor end
    if not strlower then strlower = string.lower end
    if not frexp then frexp = math.frexp end
    if not strmatch then strmatch = string.match end
    if not ldexp then ldexp = math.ldexp end
    if not strrep then strrep = string.rep end
    if not log then log = math.log end
    if not strrev then strrev = string.reverse end
    if not max then max = math.max end
    if not strsub then strsub = string.sub end
    if not min then min = math.min end
    if not strupper then strupper = string.upper end
    if not mod then mod = math.fmod end
    if not foreach then foreach = table.foreach end
    if not rad then rad = math.rad end
    if not foreachi then foreachi = table.foreachi end
    if not random then random = math.random end
    if not getn then getn = table.getn end
    if not randomseed then randomseed = math.randomseed end
    if not sort then sort = table.sort end
    if not sqrt then sqrt = math.sqrt end
    if not tinsert then tinsert = table.insert end
    if not format then format = string.format  end
    if not tremove then tremove = table.remove end
    if not gmatch then gmatch = string.gmatch end
chrixian is offline   Reply With Quote