lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


> Sorry for the dumb questions, I am still learning, and certainly
> on a par with
> the gentlemen discuting coroutines or OO...

Ouch, that's "NOT on a par with"...

Reuben Thomas wrote:
> > In section 3, you say "The form t:f(x) is syntactic sugar for t.f(t,x), 
which
> > calls the method f from the table t passing the table itself as the first
> > parameter (see Section 4.5.9).".
>
> > In section 4.5.9, you say "The statement function v:f (...) ... end is 
just
> > syntactic sugar for v.f = function (self, ...) ... end
> > Note that the function gets an extra formal parameter called self."
>
> You're just confusing formal and actual parameters: if you define a function
> as:
>
> v:f () ... end
>
> you actually get
>
> v.f = function (self) ... end
>
> and then when you call it with v:f(), the actual call made is v:f(v), so
> self gets set to v within f.

OK, I didn't read attentively enough, I didn't saw the first paragraph was 
about calling the function, while the second one was about defining the 
function... So the question is indeed dumb...

Thank you.

¯`·._.·´¯`·._.·´¯`·._.·´¯`·._.·´¯`·._.·´¯`·._.·´¯`·._.·´¯
Philippe Lhoste (Paris -- France)
Professional programmer and amateur artist
http://jove.prohosting.com/~philho/
http://philho.multimania.com/
_.·´¯`·._.·´¯`·._.·´¯`·._.·´¯`·._.·´¯`·._.·´¯`·._.·´¯`·._