Mercurial > wow > askmrrobot
diff AskMrRobot.lua @ 13:bb0c8ce689d1 v1.2.15.0
fixed minor bug on startup with new settings
author | yellowfive |
---|---|
date | Thu, 10 Jul 2014 15:25:18 -0700 |
parents | ece9167c0d1c |
children | e77e01abce98 |
line wrap: on
line diff
--- a/AskMrRobot.lua Thu Jul 10 13:20:32 2014 -0700 +++ b/AskMrRobot.lua Thu Jul 10 15:25:18 2014 -0700 @@ -270,22 +270,24 @@ elseif event == "PLAYER_ENTERING_WORLD" then -- delete entries that are more than 10 days old to prevent the table from growing indefinitely - local now = time() - local oldDuration = 60 * 60 * 24 * 10 - local entryTime - repeat - -- parse entry and get time - local parts = {} - for part in string.gmatch(AmrSettings.Logins[1], "([^;]+)") do - tinsert(parts, part) - end - entryTime = tonumber(parts[3]) + if AmrSettings.Logins and #AmrSettings.Logins > 0 then + local now = time() + local oldDuration = 60 * 60 * 24 * 10 + local entryTime + repeat + -- parse entry and get time + local parts = {} + for part in string.gmatch(AmrSettings.Logins[1], "([^;]+)") do + tinsert(parts, part) + end + entryTime = tonumber(parts[3]) - -- entries are in order, remove first entry if it is old - if difftime(now, entryTime) > oldDuration then - tremove(AmrSettings.Logins, 1) - end - until #AmrSettings.Logins == 0 or difftime(now, entryTime) <= oldDuration + -- entries are in order, remove first entry if it is old + if difftime(now, entryTime) > oldDuration then + tremove(AmrSettings.Logins, 1) + end + until #AmrSettings.Logins == 0 or difftime(now, entryTime) <= oldDuration + end -- record the time a player logs in, used to figure out which player logged which parts of their log file local key = AmrRealmName .. ";" .. AmrCharacterName .. ";"