Thread Tools Display Modes
11-17-20, 08:23 AM   #1
fuba
A Murloc Raider
Join Date: Nov 2014
Posts: 8
Access "AddOn namespace" (addonName, addonTable = ...) from outside?

Hi there,

i got a question about AddOn namespace or more specific the "addonTable".

What exactly i mean?
Some AddOns did not set there AddOn Table for Global Access (becasue?! Reasons!)

Like this:
Lua Code:
  1. local addonName, addonTable = ...
or this:
Lua Code:
  1. local _, Engine = ...

I know i can edit this AddOn(s) manually by adding a Global Variable like:
Lua Code:
  1. local addonName, addonTable = ...
  2. _G[addonName] = addonTable
or
Lua Code:
  1. local _, Engine = ...
  2. _G.MyAddOnEngine = Engine

BUT there must be another way, without "touching" the original addon, right?

I found some Threads here that say "just set "Dependencies" in your TOC file for the AddOn and you can access it.
But i cant get it work!

Is there anything i look over? ^^

Maybe someone can help!

greetings,
fuba
  Reply With Quote
11-17-20, 09:51 AM   #2
Fizzlemizz
I did that?
 
Fizzlemizz's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Dec 2011
Posts: 1,871
The addition of the addon table (Namespace if you will) was exactly to avoid the situation of having to create functions and data as global if you only wanted to share it between other modules in your addon. If an addon only has one .lua file or doesn't have code to share within the addon, it doesn't need to use the addon table.

That's the authors choice.

The only way you can access addon table data from other addons is if you edit the code and make a reference to it in the global table, as you showed or if the author has placed a reference to it in the global table or in another table that is also global (like a frame).
__________________
Fizzlemizz
Maintainer of Discord Unit Frames and Discord Art.
Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus.

Last edited by Fizzlemizz : 11-17-20 at 10:16 AM.
  Reply With Quote
11-17-20, 11:15 AM   #3
fuba
A Murloc Raider
Join Date: Nov 2014
Posts: 8
Originally Posted by Fizzlemizz View Post
The addition of the addon table (Namespace if you will) was exactly to avoid the situation of having to create functions and data as global if you only wanted to share it between other modules in your addon. If an addon only has one .lua file or doesn't have code to share within the addon, it doesn't need to use the addon table.

That's the authors choice.

The only way you can access addon table data from other addons is if you edit the code and make a reference to it in the global table, as you showed or if the author has placed a reference to it in the global table or in another table that is also global (like a frame).
Ok, thanks :/
  Reply With Quote

WoWInterface » Developer Discussions » General Authoring Discussion » Access "AddOn namespace" (addonName, addonTable = ...) from outside?

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off