• 0

    posted a message on Access Addon from Outside
    Actually I found a way, to resolve my problem. Perhaps not the cleanest. If anyone know a cleaner way, I would be happy to know.

    My acutal solution is changing the creation of my addon.
    local AceAddon = LibStub("AceAddon-3.0")
    local AngryAssignAura = AceAddon:NewAddon("AngryAssignments_Aura", "AceConsole-3.0", "AceEvent-3.0", "AceComm-3.0", "AceTimer-3.0")

    Now I wrote a function, that uses my new variable AceAddon.
    function AngryAura() 
    	return AceAddon:GetAddon("AngryAssignments_Aura", true)

    So finally I can call:
    /run AngryAura():GetPlayerGroupNumber("Test")
    Posted in: Lua Code Discussion
  • 0

    posted a message on Access Addon from Outside
    I want to write an addon, that receives the data of AngryAssignments und provides some utility functions for WeakAura. Let's say for example an aura, that displays if you are a kicker for Socrethar and when you should kick or something like that.

    Getting the informations from AngryAssignments is not that problem. Write some code, that watches the combat log and shares information between raidmember seems also not that problem. But actually I am having trouble to access my methods from outside.

    At first attempt I copied the basic code of AngryAssignments and deleted everything I don't needed.

    AngryAssignAura = LibStub("AceAddon-3.0"):NewAddon("AngryAssignments_Aura", "AceConsole-3.0", "AceEvent-3.0", "AceComm-3.0", "AceTimer-3.0")
    local AceGUI = LibStub("AceGUI-3.0")
    local libS = LibStub("AceSerializer-3.0")
    local libC = LibStub("LibCompress")
    local lwin = LibStub("LibWindow-1.1")
    local libCE = libC:GetAddonEncodeTable()
    local LSM = LibStub("LibSharedMedia-3.0")
    function AngryAssignAura:GetPlayerGroupNumber(playerName) 
    	DEFAULT_CHAT_FRAME:AddMessage(string.format("playerName=%q", playerName))
    function AngryAssignAura:CHAT_MSG_ADDON(prefix, message, distributionType, sender)
    	-- DEFAULT_CHAT_FRAME:AddMessage("AngryAssignAura:CHAT_MSG_ADDON() called")
    function AngryAssignAura:COMBAT_LOG_EVENT_UNFILTERED(timestamp, combatEvent, arg3, sourceGUID, sourceName, sourceFlags, arg7, destGUID, destName, destFlags, arg11, spellID, spellName, spellSchool)
    	-- DEFAULT_CHAT_FRAME:AddMessage("AngryAssignAura:COMBAT_LOG_EVENT_UNFILTERED() called")
    function AngryAssignAura:OnEnable() 

    Then I tried to call
    /script AngryAssignAura.GetPlayerGroupNumber("Test")

    , but this fails. The error mentions, that "GetPlayerGroupNumber" is a nil value. So I checked my AngryAssignAura variable.

    /script for k,v in pairs(AngryAssignAura) do print(string.format("[%q]=%s", k, type(v))) end

    Can't find any information about the functions I have written. I tried to look into the AceAddon Library, to understand what's going on there. But that's not something I can understand at first attempt. ;)

    So how can I access my functions from external? The main idea is to shrink the required custom code in WeakAura. ;)
    Posted in: Lua Code Discussion
  • To post a comment, please or register a new account.