attempt to index local 'f' (a nil value)
I have this function in my personal addon which worked until before Legion but it seems that Blizz changed something. Since the error message is kind of generic a search turned up nothing. I'm not really a coder, I just fumble around, so if someone could help me out ...
local function Hide(f) f:SetScript('OnShow', f.Hide) f:Hide() end Also I have some key bindings defined and I'm too stupid to find out which is the key binding name for lfg groups. This one just works for manually created groups: <Binding name="Party" > ChatFrame_OpenChat("/p"); </Binding> |
The path of least resistance.
Lua Code:
|
What MunkDev provided will prevent the error, but that's all anyone can do for you with what you provided. We need to know what is using Hide() and what f is supposed to be if you want to dig deeper and find out why f is nil. There is nothing wrong with the function as seen here.
As for any queue groups, the chat is called "Instance" and uses /i to activate. |
Thank you for answering.
I'm attempting to hide (MiniMapMailFrame,VehicleSeatIndicator) and move (BuffFrame) various stuff from the UI ... edited because obsolete - forget about the "f"-stuff. The old simple way works again after another UI reset. Code now looks like this (I edited this for clarity in case somebody else has similar problems): Code:
MainMenuBarLeftEndCap:Hide() |
Well f in this case is a variable and no offence, but are you sure you should be trying to fix this considering you have to ask that? :P The function Hide is being called somewhere with a nil argument, where it's expecting a frame. Look for references to Hide.
|
Quote:
Quote:
Edit: I did another complete UI reset and the simple stuff works again - without "f" and any of the complicated things I tried out of desperation. Now onto the hunt what was interfering ... Only remaining problem is that the hidden VehicleSeatIndicator is still somehow in the way. Whenever a passenger mount is used the resized ObjectiveTrackerFrame moves left ... Any tips on that? |
Read the Lua Basics section from this post, and consider clicking through the introduction section of the lua manual, because if you don't understand how a variable gets passed to a function then you are going to be in for a bad time trying to program an addon.
|
I'd also probably recommend HookScript over SetScript.
Setting OnEvent script to nil is also redundant if you're unregistering all events from the frame anyway (and depending on the frame, could just taint.) |
Thank you for your answers. I followed the wrong track with my original question and solved the problem once I realized that. I will do the RTFM work that you recommended.
|
All times are GMT -6. The time now is 09:19 AM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI