View Single Post
08-17-13, 09:20 AM   #1
SkyTwister
A Murloc Raider
Join Date: Aug 2013
Posts: 4
Question Calling a function from another addon

As per the above is this possible. I assume it is what with libraries etc being stand alone, but unsure if the specific functions needs to be detailed in a specific way for them to be available or not.

Reason I'm asking is I'm currently creating an addon to do something very specific for me with relation to pet battles (I may publish it eventually but it's more of a side project to introduce me to Lua etc). I'd like the ability to call on some of the functionality in another addon, PetBattleTeams, rather than reinventing the wheel and copying the functionality of PetBattleTeams into my own addon.

Have tried

NumTeams = TeamManager:GetNumTeams() but getting the 'attempt to index global "TeamManager" (a nil value)' error (to be fair I expected something like that to happen).

Also tried just NumTeams = GetNumTeams() with the error 'attempt to call global "GetNumTeams" (a nil value)'.

Function in PetBattleTeams is written like so:

Lua Code:
  1. function TeamManager:GetNumTeams()
  2.     return #self.teams
  3. end

I have also added it as a dependency (so it loads first).

Any help graciously appreciated and if you need more info let me know.

~SkyTwister
  Reply With Quote