View Single Post
09-13-10, 02:38 PM   #17
IQgryn
A Cyclonian
AddOn Author - Click to view addons
Join Date: Jul 2008
Posts: 46
Originally Posted by MysticalOS View Post
i'd basically have to paste the entire contents of addon then,c ause honestly it's got so many problems. i've only managed to fix maybe a handful of the many. i fixed onload and onevent only. since there were good examples of both on here. but every other fuction, changing this to self causes that entire function to just nil error. i've tried many variations of self, event, ..., or just self, or just eventname etc in the function and nothing makes it return anything but nil without changing all the self's back to this. as for addon itself i don'te ven know why it was pulled, maybe by author request, it got removed from ALL addon sites sometime this year, it's last update was dec 2009 and only remaining place it's hosted is http://www.tankadin.com/index.php?op...d&catid=8:mods

yet to date i haven't liked a single other raid marking addon but luckycharms2. it'd probably take less than 5 min for someone that knows what their doing to fix. unfortunately i've never really been good with the coding functions. I'm more of a template guy, give me a template to follow and i can do entire addons. I was able to add thousands of lines of code to DBM using examples that already exist in core and earlier raid mods. but ask me to actually add a new function from scratch and i'm clueless
After a brief look at the code, I can only say that it's a mess. However, to try to help you out: these four code snippets all work exactly the same way.

Code:
function MyAddon:MyFunc(var1) print(self, var1) end
MyAddon:MyFunc("test value")
Code:
function MyAddon.MyFunc(self, var1) print(self, var1) end
MyAddon.MyFunc(MyAddon, "test value")
Code:
function MyAddon:MyFunc(var1) print(self, var1) end
MyAddon.MyFunc(MyAddon, "test value")
Code:
function MyAddon.MyFunc(self, var1) print(self, var1) end
MyAddon:MyFunc("test value")
In other words:
When defining a function, if a colon is used, self will be the first parameter (before any others you list).
When calling a function, self is automatically passed (as the first argument) with the value of whatever is before the colon when you use a colon instead of a period.

You can mix and match the period and the colon without any problems as long as you remember to pass/declare self when you use a period. However, this can get confusing and it's probably best to just stick with a colon for function that need self and a period otherwise.