How to access an addon's function?
For example, an addon named "ABC" use title like:
Code:
local A, B, C = unpack(select(2, ...)) The belowing line seems not working by using the addon name. Code:
local A, B, C = unpack("ABC") |
It would be better if you gave the actual code, but I'm going to assume that top line is near the top of the addon's file. When an addon's code loads, it is given a vararg, which is ... and it contains the addon's name and a table that is shared among all files within that addon folder.
When you used the code, you aren't getting the same code that addon is getting. Also, that addon is localizing those functions by putting them in local tables. This means that you can only change them manually in the addon's files. It is not possible to change those functions without editing that addon's files. |
Quote:
Lua Code:
Heres my code that i use as engine to access all my functions in every file. Lua Code:
in every file to access those functions. |
Quote:
Code:
local A, C, L = select(2, ...):unpack() For other addon, it should be fine to just "local A, C, L = select(YourAddonName):unpack()", because of the bottom line of your code "_G[AddOnName] = Engine". So now, for some addon that doesn't have the bottom code as you do, is there any way to access as well? |
As I stated above, it is not possible. The vararg passed to each file of an addon is through Blizzard’s addon loader and is unique to each addon. You have to edit the addon’s files directly to either change what you want or make what you want to access a global.
|
Quote:
local A, C, L = unpack(YourAddonName) |
Quote:
Currently, the only way I can do is to edit the file inside the addon. |
I had a similar request not too long ago
http://www.wowinterface.com/forums/s...ad.php?t=54765 |
Anyone that answers anything but it's up to the addon author to expose their environment is either wrong or misunderstood what you're asking for. If something isn't globally accessible for you to modify, your best bet is probably to ask whoever designed it to make it so.
|
All times are GMT -6. The time now is 07:52 AM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI