Need help with an addon writting
Hi, sorry I know everyone is very busy atm but I'm getting crazy over here. Yesterday I finished testing an addon and all was fine and published it: ToggleGroupFrame. Today I log in and catastrophe I got this error:
Code:
:1: function expected instead of nil Here's the lua: Code:
local addon = { name = "ToggleGroupFrame" } Code:
<Bindings> |
First, you'll want to look at the error. What line does it say, and what code is on that line? That's always critical information for figuring out errors. Second, what does function expected instead of nil mean? Well, it means that on that line of code, you have functionName(), but functionName is actually nil. So make sure the function is actually declared.
Finally, you need to either make your functions local, or pop them in your addon table. They are currently global, so if anyone addon declares a global Initialize function (pretty likely tbh) it'll overwrite yours |
Not sure why but if I dowload your currently uploaded addon file Windows Defender pops in and says your file is a virus.
Maybe a false positive but are you sure you had uploaded the actual addon and nothing else? :p And yes, please, as Dolgubon already said: Always put a local in front of your function names! Or if you define a table local addon, add the functions to that table function addon.OnCombatStateChanged(param) function addon.Initialize(param) function addon.UpdateGroupFrameVisibility(param) and call them the same addon.OnCombatStateChanged(...) or addon.Initialize, or addon.UpdateGroupFrameVisibility -> Keep in mind that local functions and code cannot be accessed from XML files of your addon, so see below how to fix this. Else you might overwrite other addons/ZOs lua code, or some other addon might do that at your addon. Everything not explicitly defined local is global and must use a very unique name, which in your case could be function ToggleGroupFrame_OnCombatStateChanged e.g. but actually that's not needed. Keep it local. Or create 1 global table ToggleGroupFrame = {} and add all functions and variables to that, so you can call it from XML code. Else it may overwrite, or get overwritten! |
Quote:
|
Quote:
Now, I've followed your indications and came up with this, it works though my saved variables .. aren't saved anymore so more work needed. Code:
ToggleGroupFrame = {} |
All times are GMT -6. The time now is 09:58 AM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2014 - 2022 MMOUI