bestelbus22@lemmy.world to Programmer Humor@lemmy.mlEnglish · 1 year agoThe meaning of thislemmy.mlimagemessage-square65linkfedilinkarrow-up11arrow-down10
arrow-up11arrow-down1imageThe meaning of thislemmy.mlbestelbus22@lemmy.world to Programmer Humor@lemmy.mlEnglish · 1 year agomessage-square65linkfedilink
minus-squareDie Mart Die@sh.itjust.workslinkfedilinkarrow-up0·1 year agoKinda. Lua defines it implicitly only when you use the function foo:bar(a, b, c) -- note the colon syntactic sugar, which gets translated to function foo.bar(self, a, b, c)` -- note the period In all other cases, self is a regular variable name. You can even redeclare a new local with that name even when the old one is in scope.
minus-squarejsomae@lemmy.mllinkfedilinkarrow-up0·1 year agoI don’t see how what you said is inconsistent with me saying “self” is special in lua. Note that I did not say it’s a keyword.
Kinda.
Lua defines it implicitly only when you use the
function foo:bar(a, b, c) -- note the colonsyntactic sugar, which gets translated to
function foo.bar(self, a, b, c)` -- note the periodIn all other cases,
selfis a regular variable name. You can even redeclare a new local with that name even when the old one is in scope.I don’t see how what you said is inconsistent with me saying “self” is special in lua. Note that I did not say it’s a keyword.
Derp, I misread.