Mercurial > wow > reaction
diff Button.lua @ 305:0211bcdfab70 stable
Merge 1.1 beta 12 to stable
author | Flick |
---|---|
date | Wed, 14 Nov 2012 16:47:27 -0800 |
parents | e337b39dc491 |
children |
line wrap: on
line diff
--- a/Button.lua Fri Aug 05 16:28:13 2011 -0700 +++ b/Button.lua Wed Nov 14 16:47:27 2012 -0800 @@ -204,6 +204,10 @@ if not poolID or not maxID then error("AcquireActionID: must setup pool first with SetActionIDPool") end + hint = tonumber(hint) + if hint and (hint < 1 or hint > maxID) then + hint = nil + end local pool = idPools[poolID] if not pool then pool = { nWraps = 0, useCount = { } } @@ -216,19 +220,19 @@ if id == nil then repeat local nWraps = pool.nWraps or 0 - if hint and (useCount[hint] == nil or useCount[hint] == nWraps) then + if hint and (useCount[hint] == 0 or useCount[hint] == nWraps) then id = hint else local start = hint or 1 for i = start, maxID do - if useCount[i] == nil or useCount[i] == nWraps then + if useCount[i] == 0 or useCount[i] == nWraps then id = i break end end if not id then for i = 1, start do - if useCount[i] == nil or useCount[i] == nWraps then + if useCount[i] == 0 or useCount[i] == nWraps then id = i break end