Quantcast
ESOUI - View Single Post - Updating stuff on the Wiki
View Single Post
04/13/14, 08:34 AM   #15
Iyanga
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 185
Originally Posted by Cr4x View Post
I would say, it depends how it is declared.
because you should always document the declaration and not the "calls"
Right.

Exactly what I said:
string.len(s)
not string.len()

They gave the shorthand example if you have an instance of string named s, too.
s:len() (they didn't write string.len() for a reason..)


Declaration: function MyObj.myfunc(self, param1,param2) end
Usage: MyObj.myfunc(MyObj, foo, bar)
or: MyObj:myfunc(foo,bar)

however >
Declaration: function MyObj:myfunc(param1, param2) end
Usage: MyObj.myfunc(MyObj, foo, bar)
or: 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.

"The effect of the colon is to add an extra hidden parameter in a method definition and to add an extra argument in a method call. The colon is only a syntactic facility""

MyObj:myfunc(param1, param2)
IS the definition of myfunc(MyObj, param1, param2)

Even the LUA documentation you linked agrees with me that it is part of the argument. How can it NOT be part of the argument list if you can access it as argument...?

Last edited by Iyanga : 04/13/14 at 08:39 AM.
  Reply With Quote