Quantcast

Lua error fixed

Alar of Runetotem [08-01-18 - 11:10]
Lua error fixed

1x [string "return GetMonthInfo(6)"]:1: attempt to call global
'GetMonthInfo' (a nil value)
Filename
GarrisonCommander-Broker/RelNotes.lua
GarrisonCommander-Broker/ldb.lua
diff --git a/GarrisonCommander-Broker/RelNotes.lua b/GarrisonCommander-Broker/RelNotes.lua
index 1a49b20..34236de 100644
--- a/GarrisonCommander-Broker/RelNotes.lua
+++ b/GarrisonCommander-Broker/RelNotes.lua
@@ -7,6 +7,9 @@ self:HF_Paragraph("Description")
 self:HF_Pre([[
 Data broker for Garrison stuff.
 ]])
+self:RelNotes(2,18,8,[[
+Fix: Removed lua error GetAbsoluteMonth
+]])
 self:RelNotes(2,15,3,[[
 Fix: Ticket 158  attempt to call method 'loadHelp' (a nil value)
 ]])
diff --git a/GarrisonCommander-Broker/ldb.lua b/GarrisonCommander-Broker/ldb.lua
index f635f4f..65447c0 100644
--- a/GarrisonCommander-Broker/ldb.lua
+++ b/GarrisonCommander-Broker/ldb.lua
@@ -202,12 +202,9 @@ function addon:CheckDateReset()
 	end

 	today=year*10000+month*100+day
-	if month==1 and day==1 then
-		local m, y, numdays, firstday = CalendarGetAbsMonth( 12, year-1 )
-		yesterday=y*10000+m*100+numdays
-	elseif day==1 then
-		local m, y, numdays, firstday = CalendarGetAbsMonth( month-1, year)
-		yesterday=y*10000+m*100+numdays
+	if day==1 then
+    local t=C_Calendar.GetMonthInfo(-1)
+		yesterday=t.year*10000+t.month*100+t.numDays
 	else
 		yesterday=year*10000+month*100+day-1
 	end