Some fixes to spells/cooldowns.

* Fixed 'progress' bug for spells in the cooldown module.
* Fixed a bug with GameForceFirstAutoWalkStep feature.
* Moved the spells ID to its SpellInfo row.
* Lower cased table functions (consistant).
This commit is contained in:
BeniS
2013-01-29 19:26:32 +13:00
parent b7eef97239
commit ec30567d6b
10 changed files with 225 additions and 168 deletions

View File

@@ -56,11 +56,20 @@ function table.find(t, value, lowercase)
end
end
function table.findbykey(t, key, lowercase)
for k,v in pairs(t) do
if lowercase and type(key) == 'string' and type(k) == 'string' then
if k:lower() == key:lower() then return v end
end
if k == key then return v end
end
end
function table.contains(t, value)
return table.find(t, value) ~= nil
end
function table.findKey(t, key)
function table.findkey(t, key)
if t and type(t) == 'table' then
for k,v in pairs(t) do
if k == key then return k end
@@ -68,8 +77,8 @@ function table.findKey(t, key)
end
end
function table.hasKey(t, key)
return table.findKey(t, key) ~= nil
function table.haskey(t, key)
return table.findkey(t, key) ~= nil
end
function table.removevalue(t, value)
@@ -129,7 +138,7 @@ function table.findbyfield(t, fieldname, fieldvalue)
return nil
end
function table.toString(t)
function table.tostring(t)
local maxn = #t
local str = ""
for k,v in pairs(t) do

View File

@@ -59,7 +59,7 @@ function UIComboBox:setCurrentIndex(index)
end
function UIComboBox:getCurrentOption()
if table.hasKey(self.options, self.currentIndex) then
if table.haskey(self.options, self.currentIndex) then
return self.options[self.currentIndex]
end
end

View File

@@ -216,7 +216,7 @@ end
function UITable:setHeaderColumnStyle(style)
self.headerColumnBaseStyle = style
if table.hasKey(HEADER_ID) then
if table.haskey(HEADER_ID) then
self.columns[HEADER_ID]:setStyle(style)
end
end