1
0
Fork 0

Prevent LUA error from displaying when calendar hasn't been opened yet while debugging.

This commit is contained in:
Andrew Tomaka 2011-08-31 03:30:12 -04:00
parent 6f02e8a50d
commit af150e321f

View file

@ -202,7 +202,8 @@ end
function core:GetNextVPReset() function core:GetNextVPReset()
--prepare calendar --prepare calendar
local currentCalendarSetting = GetCVar('calendarShowResets') -- get current value and store local currentCalendarSetting = GetCVar('calendarShowResets') -- get current value and store
SetCVar('calendarShowResets',1) -- set it to what we want SetCVar('calendarShowResets', 1) -- set it to what we want
OpenCalendar()
--figure out what time the server resets daily information --figure out what time the server resets daily information
local questReset = GetQuestResetTime() local questReset = GetQuestResetTime()
@ -211,6 +212,8 @@ function core:GetNextVPReset()
--figure out reset day using next BH lockout --figure out reset day using next BH lockout
local _, month, day, year = CalendarGetDate() local _, month, day, year = CalendarGetDate()
--calendar not yet loaded? Cannot find events when first fires of this;
--"arbitrarily" fires at unknown time.
local monthOffset = 0 local monthOffset = 0
local resetDate = nil local resetDate = nil
while resetDate == nil do while resetDate == nil do
@ -240,9 +243,13 @@ function core:GetNextVPReset()
SetCVar('calendarShowResets',currentCalendarSetting) SetCVar('calendarShowResets',currentCalendarSetting)
--and combine for the reset timestamp --and combine for the reset timestamp
if(resetDate ~= nil) then
resetDate.hour = resetTime.hour resetDate.hour = resetTime.hour
resetDate.min = resetTime.min resetDate.min = resetTime.min
resetDate.sec = resetTime.sec resetDate.sec = resetTime.sec
return time(resetDate) return time(resetDate)
else
print('resetDate not set')
end
end end