• 0

    posted a message on Just wondering...
    Tekkub has a good point. Allowing your entire addon to be hooked could cause problems if someone screwed something up in the process. Your "Error" that some people are reporting could simply be another addon messing something up internally...We all know how many people actually turn everything BUT that addon off before they report a bug...

    Also API is nice. Normally its much easier for other addons to use than hooking too. I used to hook DBM to make a timer on a unrelated addon that doesn't require it. On the other hand I can just called "local DBTId = DBT:New()" and then call "DBTId:CreateBar(...)"

    If the addon user wants you to hook into it, they should allow you API to do it or let you ask for the API function to use.
    Posted in: Lua Code Discussion
  • 0

    posted a message on [target=player,flyable]
    Thats odd, But couldn't you write a small lua function for this?...Summoning mounts isn't secure, and im pretty sure there are functions to determine if you can fly + if you have learned cold weather training.
    Posted in: Lua Code Discussion
  • 0

    posted a message on Ace-Addon + OnUpdate?
    local SkullMe = SkullMe has the same performance as self when referenced?...Or am I negating the performance upgrade by wrapping it in a function.

    Im not quite sure why im going thru all this this make a addon that already doesn't run alot faster but aww well. Its done feature wise so this is whats left.
    Posted in: Lua Code Discussion
  • 0

    posted a message on Ace-Addon + OnUpdate?
    Okay ill look into AceTimer-3.0

    Also did that question about local self = SkullMe at the top of the file break some forbidden rule or is that a reasonable solution in the future..I mean it doesnt SEEM that bad but I have a feeling theres a problem with doing that.

    At least i havent tryed to save _G yet as a saved var.
    Posted in: Lua Code Discussion
  • 0

    posted a message on AceGUI noob question
    Actually you made a typo in your code.

    -- Register your addon with AceAddon
    MyAddon = LibStub("AceAddon-3.0"):NewAddon("MyAddon")
    
    -- Register your saved variables with AceDB
    MyAddon.db = LibStub("AceDB-3.0"):New("MyAddonDB", defaultsTable, "Default")
    
    -- Register your options with AceConfigRegistry
    LibStub("AceConfig-Registry-3.0"):RegisterOptionsTable("MyAddon", options)
    
    -- Add your options to the Blizz options window using AceConfigDialog
    LibStub("AceConfig-Dialog-3.0"):("MyAddon")
    You had Libstub("[AceConfig-Dialog-3.0"):("MyAddon")

    Im not sure how your registering your options table,never seen it done like that, either but this is what I use...

    If your getting a error its probably because your not calling a function on the last line, unless theres a _index with a function in AceConfig you need to use
    LibStub("[AceConfig-Dialog-3.0"):AddToBlizOptions("MyAddon")

    Heres some example code that DOES work
    -- Remember these MUST be loaded when you call your code altho that should be obvious its not always.
    -- Get a instance of AceConfig to use
        local config = LibStub("AceConfig-3.0")
    -- Get a instance of AceConfigDialog
        local dialog = LibStub("AceConfigDialog-3.0")
    
    -- Actually register the table with ace
        config:RegisterOptionsTable("MyAddon-Bliz", options)
    -- Add to bilizzard options.
        dialog:AddToBlizOptions("MyAddon-Bliz", "MyAddon")
    Where options is your options table. It only requires that the lib is loaded I believe, and it automaticly adds it to blizzard options. Remember to rename MyAddon to your addon name.

    Also if you define the options table outside a function you cannot use self for ace-db so I suggest you call it by a filescope local or you put it in a function that has self passed to it.

    If anyone sees a problem with anything I suggested im pretty new to ace and please correct me.
    Posted in: Lua Code Discussion
  • 0

    posted a message on Ace-Addon + OnUpdate?
    Okay so im probably going to get 50 lashes with a wet noodle for asking this. If im going to set a local SkullMe, Can't I just rename it self while im at it?...Anywhere self would be used in my code and it isnt defined it would default to my file scope local.
    Posted in: Lua Code Discussion
  • 0

    posted a message on Ace-Addon + OnUpdate?
    So the question becomes, Do i reference a global 5-10 times each frame or do I wrap the function to redefine a local or do I use self = SkullMe. Bah time to os.clock everything.

    Edit: You cant os.clock in WoW. Thats pretty lame or im missing something.
    Posted in: Lua Code Discussion
  • 0

    posted a message on Ace-Addon + OnUpdate?
    It makes everything easier to me to be able to see self, and its not as easily broken...I used the follow wrapper to make it work.

    local frame = CreateFrame("Frame", "SkullMeFrame")
    frame:SetScript("OnUpdate",self.OnUpdate)
    
    function SkullMe:OnUpdate(elap)
        SkullMe:Onupdate(elap)
    end
    SkullMe:Onupdate() is the actual function, SkullMe:OnUpdate is the wrapper
    Posted in: Lua Code Discussion
  • 0

    posted a message on Ace-Addon + OnUpdate?
    Im trying to find a correct way to make a OnUpdate while using Ace-Addon. Right now im creating a frame, setting a OnUpdate, then im redeclaring self inside the OnUpdate function. Im guessing this isnt how your supposed to do it?
    Posted in: Lua Code Discussion
  • 0

    posted a message on Skull Me
    Bah I decided to do a full rewrite of all my code, with the goal of it being clean to start out with, remaking code pieces at a time is becoming a major pain.

    EDIT: Im doing alot of commenting to make sure my old logic is smart, does alot of comments effect anything in the addon other than maybe file size?...Should I make sure to release my SkullMe releases commentless to speed up loading the file or does it matter?
    Posted in: Lua Code Discussion
  • 0

    posted a message on Skull Me
    Wow...I really didn't know that. That makes things so much simplier in almost ALL cases lol. Thanks, this thread has taught me alot about tables lol
    Posted in: Lua Code Discussion
  • 0

    posted a message on Skull Me
    Will that create a reference to the table or copy the table?
    Posted in: Lua Code Discussion
  • 0

    posted a message on Skull Me
    Well I did it and I dont think its generating lots of garbage, but ill go in and self.db everything later today. Do i just save SkullMeG.db then?
    Posted in: Lua Code Discussion
  • 0

    posted a message on Loot Filter
    Okay so if i follow the practice of doing....

    function SkullMe:OnUpdate(elap, ...)
    local arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9 = ...

    Does that create alot of garbage?...I like the naming style even tho I prob shouldnt...Any suggestions on what to do with that?
    Posted in: Addon Ideas
  • 0

    posted a message on Skull Me
    So does that mean I can create the frame once and saved var it with all the settings?

    EDIT: I used a SkullMeG = SkullMeG or CreateFrame("Frame", "SkullMe") to get my desired results...Turns out since its just a table thats created you can save frames?...Wow thought it was more complex than that lol
    Posted in: Lua Code Discussion
  • To post a comment, please or register a new account.