InFlight TWW - Taxi Timer

InFlight TWW - Taxi Timer

6.6k Downloads

InFlight.lua:156: attempt to index upvalue 'vars'

Closed this issue ยท 9 comments

commented

Getting the following LUA error after applying the changes (v11.0.4) from today. (And TY for keeping this updated!)


2x InFlight/InFlight.lua:156: attempt to index upvalue 'vars' (a nil value)
[string "@InFlight/InFlight.lua"]:156: in function <InFlight/InFlight.lua:145>
[string "=[C]"]: ?

Locals:
button = Frame {
inflighted = true
taxiNodeData =

{
}
endScale = 1.275000
pinTemplate = "FlightMap_FlightPointPinTemplate"
isMapLayerTransition = false
owner =
{
}
nudgeSourceRadius = 1
atlasFormat = "%s"
nudgeSourceZoomedInMagnitude = 2
nudgeSourceZoomedOutMagnitude = 1
Icon = Texture {
}
linkedPins =
{
}
normalizedY = 0.522851
IconHighlight = Texture {
}
startScale = 0.962500
scaleFactor = 1.250000
owningMap = FlightMapFrame {
}
OnAddAnim = AnimationGroup {
}
normalizedX = 0.507628
useSpecialReachableIcon = false
pinFrameLevelType = "PIN_FRAME_LEVEL_FLIGHT_POINT"
}
(*temporary) = nil
(*temporary) = 2810
(*temporary) = nil
(*temporary) = nil
(*temporary) = "attempt to index upvalue 'vars' (a nil value)"
vars = nil
taxiSrc = 2810

commented

@superwario15 any clues?

commented

Hi. I don't get the error, but could someone who is getting the error message try and delete the "local" in line 156?
So instead of "local duration = vars[taxiSrc] and vars[taxiSrc][button.taxiNodeData.nodeID]" it's "duration = vars[taxiSrc] and vars[taxiSrc][button.taxiNodeData.nodeID]". That should help.

commented

I removed the 'local' kw and retried. Same error.

commented

@superwario15 any clues?

Not at this time. I'm not getting this issue on my end. I remember seeing an error that looked like this when I was testing the InFlight_Load.lua changes, but this went away once I fixed that.

commented

@jgwallace3 Could you post the code from {install location}\World of Warcraft_retail_\Interface\AddOns\InFlight_Load\Inflight_Load.lua

Like I mentioned, I was getting basically the same error during my initial fixes but the root cause was actually from another Lua error occurring in Inflight_Load.lua.

commented

Sure..
`local InFlight = CreateFrame("Frame", "InFlight") -- no parent is intentional
local self = InFlight
-- new variables for TWW API changes
local category, layout
local loadAddon = C_AddOns and C_AddOns.LoadAddOn
local C_AddOns_GetAddOnEnableState = C_AddOns.GetAddOnEnableState
-- end new variables
InFlight:SetScript("OnEvent", function(this, event, ...) this[event](this, ...) end)
InFlight:RegisterEvent("ADDON_LOADED")

-- LOCAL FUNCTIONS
local function LoadInFlight()
if not InFlight.ShowOptions then
--LoadAddOn("InFlight")
local loaded, reason = loadAddon("InFlight")
end
--return GetAddOnEnableState(UnitName("player"), "InFlight") == 2 and InFlight.ShowOptions and true or nil
return C_AddOns_GetAddOnEnableState("InFlight") and InFlight.ShowOptions and true or nil
end


function InFlight:ADDON_LOADED(addonName)

if addonName == "InFlight_Load" then
	self:RegisterEvent("TAXIMAP_OPENED")
	if self.SetupInFlight then
		self:SetupInFlight()
	else
		self:UnregisterEvent("ADDON_LOADED")
	end
elseif addonName == "InFlight" then
	self:UnregisterEvent("ADDON_LOADED")
	self:LoadBulk()
end

end


function InFlight:TAXIMAP_OPENED(...)

if LoadInFlight() then
	local uiMapSystem = ...
	local isTaxiMap = uiMapSystem == Enum.UIMapSystem.Taxi
	self:InitSource(isTaxiMap)
end

end

-- maybe this stuff gets garbage collected if InFlight isn't loadable
if C_AddOns_GetAddOnEnableState("InFlight") == 2 then
-- GLOBALS -> LOCAL
local ipairs, strfind = ipairs, strfind

-- LOCALIZATION
local L = LibStub("AceLocale-3.0"):GetLocale("InFlight", true)
InFlight.L = L

local t
do
t = {
	[L["Amber Ledge"]]					= {{ find = L["AmberLedgeGossip"],			s = "Amber Ledge",					d = "Transitus Shield (Scenic Route)" }},
	[L["Argent Tournament Grounds"]]	= {{ find = L["ArgentTournamentGossip"],	s = "Argent Tournament Grounds",	d = "Return" }},
	[L["Blackwind Landing"]]			= {{ find = L["BlackwindLandingGossip"],	s = "Blackwind Landing",			d = "Skyguard Outpost" }},
	[L["Caverns of Time"]]				= {{ find = L["CavernsOfTimeGossip"],		s = "Caverns of Time",				d = "Nozdormu's Lair" }},
	[L["Expedition Point"]]				= {{ find = L["ExpeditionPointGossip"],		s = "Expedition Point",				d = "Shatter Point" }},
	[L["Hellfire Peninsula"]]			= {{ find = L["HellfirePeninsulaGossip"],	s = "Honor Point",					d = "Shatter Point" }},
	[L["Nighthaven"]]					= {{ find = L["NighthavenGossipA"],			s = "Nighthaven", 					d = "Rut'theran Village" },
										   { find = L["NighthavenGossipH"],			s = "Nighthaven", 					d = "Thunder Bluff" }},
	[L["Old Hillsbrad Foothills"]]		= {{ find = L["OldHillsbradGossip"],		s = "Old Hillsbrad Foothills",		d = "Durnholde Keep" }},
    [L["Reaver's Fall"]]		        = {{ find = L["Reaver'sFallGossip"],		s = "Reaver's Fall",		        d = "Spinebreaker Post" }},
	[L["Ring of Transference"]]			= {{ find = L["ToBastionGossip1"],			s = "Oribos",						d = "Bastion" },
										   { find = L["ToBastionGossip2"],			s = "Oribos",						d = "Bastion" }},
	[L["Shatter Point"]]				= {{ find = L["ShatterPointGossip"],		s = "Shatter Point",				d = "Honor Point" }},
	[L["Skyguard Outpost"]]				= {{ find = L["SkyguardOutpostGossip"],		s = "Skyguard Outpost",				d = "Blackwind Landing" }},
	[L["Stormwind City"]]				= {{ find = L["StormwindCityGossip"],		s = "Stormwind City",				d = "Return" }},
	[L["Sun's Reach Harbor"]]			= {{ find = L["SSSAGossip"],				s = "Shattered Sun Staging Area",	d = "Return" },
										   { find = L["SSSAGossip2"],				s = "Shattered Sun Staging Area",	d = "The Sin'loren" }},
	[L["The Sin'loren"]]				= {{ find = L["TheSin'lorenGossip"],		s = "The Sin'loren",				d = "Shattered Sun Staging Area" }},
	[L["Valgarde"]]						= {{ find = L["ValgardeGossip"],			s = "Valgarde",						d = "Explorers' League Outpost" }},
}
end

-- support for flightpaths that are started by gossip options
-- Fix for "support for flightpaths that are started by gossip options" provided by drantor @ wowinterface.com
hooksecurefunc(_G.GossipOptionButtonMixin, "OnClick", function(this, button)
local elementData = this:GetElementData()
if elementData.buttonType ~= _G.GOSSIP_BUTTON_TYPE_OPTION then
return
end

	local subzone = GetMinimapZoneText()
	local tsz = t[subzone]
	if not tsz then

-- print("|cff00ff40In|cff00aaffFlight|r: zone - ", L[GetMinimapZoneText()], GetMinimapZoneText())
-- print("|cff00ff40In|cff00aaffFlight|r: gossip - ", this:GetText())
return
end

	local text = this:GetText()
	if not text or text == "" then
		return
	end

-- print("|cff00ff40In|cff00aaffFlight|r: gossip - ", text)

	local source, destination
	for _, sz in ipairs(tsz) do
		if strfind(text, sz.find, 1, true) then
			source = sz.s
			destination = sz.d
			break
		end
	end

	if source and destination and LoadInFlight() then
		self:StartMiscFlight(source, destination)
	end
end)

---------------------------------
function InFlight:SetupInFlight()
---------------------------------
	SlashCmdList.INFLIGHT = function()
		if LoadInFlight() then
			self:ShowOptions()
		end
	end
	SLASH_INFLIGHT1 = "/inflight"

	local panel = CreateFrame("Frame")
	panel.name = "InFlight"
	panel:SetScript("OnShow", function(this)
		if LoadInFlight() and InFlight.SetLayout then
			InFlight:SetLayout(this)
		end
	end)
	panel:Hide()
	category, layout = Settings.RegisterCanvasLayoutCategory(panel, panel.name, panel.name)
	category.ID = panel.name
	Settings.RegisterAddOnCategory(category)
	InFlight.SetupInFlight = nil
end

end
`

commented

Not seeing anything particular here that's different from what I have.

Is this the only InFlight-related Lua error you receive? I only ask because I would get several Lua errors every time I reloaded (since many addons were still broken as of last night) and the one that looked like this was listed last, but I had another InFlight-related error that occurred earlier that I was missing.

If nothing else, try replacing your InFlight_Load.lua with this one and see if anything changes. This is a .txt file since Github doesn't support .lua files in comments. Just make sure to change the file extension to .lua
InFlight_Load.txt

Unfortunately, since I can't recreate this issue, I can't do as much support as I wish I could. Unless you've already tried it, a clean install of the addon may be helpful.

commented

It was the only inflight-related lua error I saw.

Good news is using the inflight_load lua file you sent fixed the error for me and inflight now works fine!

commented

fixed in #13