View Single Post
04/13/14, 06:15 AM   #13
Iyanga
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 183
Originally Posted by Cr4x View Post
I guess all of your were right.

However, for "beginner" it is not immediately recognizable that Lua has the ":" operator which causes in this case the eventCode as first Argument.
The list of parameter are correct, however it should be mentioned at the top of the EVENT site, that there will be always the eventCode as first argument.

myfunc(object, param1, param2)

That's the signature.

That LUA allows myfunc to be called in three ways, as:
obj.myfunc(otherobj, param1, param2)
obj.myfunc(obj, param1, param2)
obj:myfunc(param1, param2)

does not suddenly change the signature of myfunc.

The signature for string.len is string.len(string s).
It is not string.len(), just because you can use name:len() as shorthand for name.len(name). And I have never seen a documentation that pretends that string.len(string s) would be string.len(). And LUA documentation is obviously even older than WoW addon documentation.


You can easily see the difference if you take the opposite example and make a function
myfunc(param1, param2)

Calling this function with obj:myfunc(param1, param2) will not work and you would never call this function with obj.myfunc(obj, param1, param2), because you see immediately that it violates the signature.
  Reply With Quote