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.
- Registered User
Member for 13 years
Last active Fri, Jan, 22 2021 10:04:02
- 0 Followers
- 30 Total Posts
- 0 Thanks
Dec 8, 2009Thats 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
Dec 8, 2009local SkullMe = SkullMe has the same performance as self when referenced?...Or am I negating the performance upgrade by wrapping it in a function.Posted in: Lua Code Discussion
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.
Dec 8, 2009Okay ill look into AceTimer-3.0Posted in: Lua Code Discussion
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.
Dec 7, 2009Actually you made a typo in your code.Posted in: Lua Code Discussion
-- 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
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.
Dec 7, 2009Okay 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
Dec 6, 2009So 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.Posted in: Lua Code Discussion
Edit: You cant os.clock in WoW. Thats pretty lame or im missing something.
Dec 5, 2009It 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.Posted in: Lua Code Discussion
local frame = CreateFrame("Frame", "SkullMeFrame") frame:SetScript("OnUpdate",self.OnUpdate) function SkullMe:OnUpdate(elap) SkullMe:Onupdate(elap) endSkullMe:Onupdate() is the actual function, SkullMe:OnUpdate is the wrapper
Dec 5, 2009Im 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
Dec 5, 2009Bah 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.Posted in: Lua Code Discussion
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?
Dec 2, 2009Okay so if i follow the practice of doing....Posted in: Addon Ideas
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?
Dec 1, 2009So does that mean I can create the frame once and saved var it with all the settings?Posted in: Lua Code Discussion
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
- To post a comment, please login or register a new account.