I recently updated my addon Historia to BFA.
All is working fine but there is one error I can't solve.
Its when I get a loading screen and then end up in a zone I haven't been before.
I get an error.
Lua Code:
20x FrameXML\MapUtil.lua:11: Usage: local info = C_Map.GetMapInfo(uiMapID)
[C]: in function `GetMapInfo'
FrameXML\MapUtil.lua:11: in function `GetMapParentInfo'
Historia\HistoriaMain.lua:326: in function `?'
Historia\HistoriaMain.lua:146: in function <Historia\HistoriaMain.lua:145>
Locals:
(*temporary) = nil
I understand the error but what I do not ouderstand is WHY I am getting it.
If statement in line 11 (line 326 in the full addon) should prevent it.
When executing the addon it will print the currentMapId as being nil
and it will print the number 1.
Think I must be missing something here
Lua Code:
function private_table.eventFrame:UI_INFO_MESSAGE(...)
local arg1, arg2 = ...
--print(arg1)
--print(arg2)
addon:Check_Dates()
if arg1 == 371 then
local zone = {}
zone.time = time()
local currentMapId, TOP_MOST = C_Map.GetBestMapForUnit('player'), true
print(currentMapId)
if currentMapId == nil then
print("1")
local zone = {}
else
print("2")
local currentContinentInfo = MapUtil.GetMapParentInfo(currentMapId, Enum.UIMapType.Continent, TOP_MOST)
print(currentContinentInfo)
zone.continent = currentContinentInfo.name
zone.zoneName = GetZoneText()
zone.subzoneName = GetSubZoneText()
table.insert(HistoriaLocalDb.Area, zone)
-- Insert new area in the dates table
table.insert(HistoriaLocalDb.Dates[addon.YS][addon.MS][addon.DS].Area, zone)
end
elseif arg1 == 280 then
local flight = {}
flight.time = time()
local currentMapId, TOP_MOST = C_Map.GetBestMapForUnit('player'), true
local currentContinentInfo = MapUtil.GetMapParentInfo(currentMapId, Enum.UIMapType.Continent, TOP_MOST)
flight.continent = currentContinentInfo.name
flight.zoneName = GetZoneText()
flight.subzoneName = GetSubZoneText()
table.insert(HistoriaLocalDb.Taxi, flight)
-- Insert new flight path in the dates table
table.insert(HistoriaLocalDb.Dates[addon.YS][addon.MS][addon.DS].Taxi, flight)
end
end