|
04/22/14, 07:38 AM | #1 | |
Trust me, I rushed through developing InventoryInsight and I have been trying to balance my time between adding features and CLEANING the code lately. I know I shouldn't have any global that will interfere with other addons but they are also not necessarily standardized... So yes, even I am going back and trying to heed my own words. |
||
04/22/14, 09:25 AM | #2 | |
|
Only 4 more to go. Edit: Hot off the trail of the global/local talk. Just had my first bug report as a bank addon and mine both had the same "function commandHandler " Which apparently led to some issues when the user typed /mb to see commands in the other addon, and got for one of my first ****ty ones. Did a quick fix to local everything, and moving functions around so they are reffering to each other in the right sequence (of code) and now I think that problem is out of the way. Really really need to do a rewrite though. Last edited by ins : 04/22/14 at 11:14 AM. |
|
04/22/14, 11:59 AM | #3 | ||
I'm glad you brought this up though, I will make a note for that to be one thing to fix in this major version of InventoryInsight I'm working on right now.
Better the mistakes be caught now and learned than to avalanche into the future. Thanks for sharing that with us Ins! |
|||
04/22/14, 12:46 PM | #4 |
The interaction can be total strange too. Garkin and I had a brief add-on conflict. It had to do with the lua convention of dumping unused return values to an underscore character. Inside on of Skyshards locally decared functions was.
Code:
_,_,_,zone,subzone = string.find(textureName, "(maps/)(%w+)/(%w+_%w+)") Code:
tcontrol:SetAnchor(TOP, _, _, x, y) Cheers, halja |
|
04/22/14, 12:55 PM | #5 | |
Pro-tip: Only use '_,' during variable assignments. If your intention is to pass nothing, then pass nothing aka nil. For example: Lua Code:
I believe '_' is still a variable as far as LUA is concerned... At least, this is how I see it... Last edited by Vicster0 : 04/22/14 at 12:59 PM. |
||
04/22/14, 04:14 PM | #6 | |
Also, yes. It just worked in your testing because _ wasn't assigned to any value and equaled nil. It would work the same way if you used VariableIWantToStayNil instead of _. Well, until someone else leaked the same variable as a global... /edit: oh yeah - and you can have more than one slash command for your addon. Just have them point to the same function. Leave the short one in as a shortcut if a user doesn't have another addon installed with the same command. |
||
04/22/14, 07:30 PM | #7 | |
Plus, I'm just saying, slash commands are kind old school... Maybe for backend dev/qa but for prod? I dunno.. lol LibAddonMenu is pretty freakin' simple... And that's coming from someone who spends the better portion of his day in a CLI... |
||
04/22/14, 01:12 PM | #8 | |
|
Edit: Oh yea, Shardwatch apparently had the same global. Funny I've had both installed for ages and never ran into a problem with either, despite both functions named commandHandler.. So it is too now Local. Last edited by ins : 04/22/14 at 01:16 PM. |
|
04/22/14, 01:46 PM | #9 | |
I'm only saying that, if that can happen because you both use the same template to create the function, what's to say you don't create the same function again, globally, and somewhat different in a separate addon. It has happened before. lol |
||
ESOUI » Developer Discussions » General Authoring Discussion » Addon Etiquette |
«
Previous Thread
|
Next Thread
»
|
Thread Tools | |
Display Modes | |
|
|