Quantcast
ESOUI - View Single Post - Updating stuff on the Wiki
View Single Post
04/17/14, 09:58 AM   #19
thelegendaryof
 
thelegendaryof's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 161
I agree that the discussion becomes a bit like running in circles.

As a conclusion I would just put an basic explanation of how those work as an introduction to Events including an example like this:

Originally Posted by Cr4x

So
Lua Code:
  1. --Declaration:
  2. function MyObj.myfunc(self, param1,param2) end
  3. --Usage:
  4. MyObj.myfunc(MyObj, foo, bar)
  5. --or:
  6. MyObj:myfunc(foo,bar)

however >
Lua Code:
  1. --Declaration:
  2. function MyObj:myfunc(param1, param2) end
  3. --Usage:
  4. MyObj.myfunc(MyObj, foo, bar)
  5. --or:
  6. MyObj:myfunc(foo,bar)

2 declarations using a different parameter list, but on the stack the functions are the same, 3 arguments, doesnt matter how they called.

In other languages you dont have to use such ":" operator, because a "this" reference to the object itselfs exists.
The rest should stay like it is as it 's correct. However the Events itself need more documentation as to when to use them or how often they fire, when they fire or what values the parameters accept. That 's more important I guess.

Back to the topic, yes the Wiki needs updates badly. I'll try to help if I find time to do so and feel like my knowdlege is good enought for it to be documented. Oh, am I blind? Wasn't there a rule or help page how to properly update the Wiki (not as in how to use a Wiki by itself more like general guidelines or rules)? I guess that would help as well!

Anyway I'll go by the principle that more info is better info. If it 's incorrect feel free to edit it later on (even thought as I said I'll try to keep it quality stuff only there 's always something you could do better or more easily or just different). That 's fine right?

Edit:

@Stormknight: I really like the way how you documented EVENT_ADD_ON_LOADED! That 's actually a good template to start of. :3

Edit 2:

Hm, however wouldn't it be better to go for a general rule to use the best performance as possible for those examples? Meaning defining them as a local function instead of pushing them into a global object? Just speaking from an optimal point of view. See here:

http://stackoverflow.com/questions/6...level-function

Hm, I need to write some tests for this later myself and see how they perform. Especially since localized functions and variables can be a nightmare if you don't keep your code structured and know what you're doing. Globalized ones might be better after all.

Last edited by thelegendaryof : 04/17/14 at 10:14 AM.
  Reply With Quote