Mercurial > wow > askmrrobot
view wait.lua @ 33:4ba69d2ee252 v9
fixed bug with gem changes not appearing sometimes, mainWindow crash on
startup, lua error for unknown item tooltips
author | yellowfive |
---|---|
date | Sat, 18 Oct 2014 18:13:55 -0700 |
parents | ece9167c0d1c |
children |
line wrap: on
line source
local _, AskMrRobot = ... local waitTable = {}; local waitFrame = nil; function AskMrRobot.wait(delay, func, ...) if(type(delay)~="number" or type(func)~="function") then print(AMR_WAIT_BAD_ARGUMENTS); return false; end if(waitFrame == nil) then waitFrame = CreateFrame("Frame","WaitFrame", UIParent); waitFrame:SetScript("OnUpdate",function (self,elapse) local count = #waitTable; local i = 1; while(i<=count) do local waitRecord = tremove(waitTable,i); local d = tremove(waitRecord,1); local f = tremove(waitRecord,1); local p = tremove(waitRecord,1); if(d>elapse) then tinsert(waitTable,i,{d-elapse,f,p}); i = i + 1; else count = count - 1; f(unpack(p)); end end end); end tinsert(waitTable,{delay,func,{...}}); return true; end