bestelbus22@lemmy.world to Programmer Humor@lemmy.mlEnglish · 19 hours agoThe meaning of thislemmy.mlimagemessage-square55fedilinkarrow-up1455arrow-down112
arrow-up1443arrow-down1imageThe meaning of thislemmy.mlbestelbus22@lemmy.world to Programmer Humor@lemmy.mlEnglish · 19 hours agomessage-square55fedilink
minus-squarejsomae@lemmy.mllinkfedilinkarrow-up3·5 hours agoLua might have been a better choice, since self is special in lua.
minus-squareDie Martin Die@sh.itjust.workslinkfedilinkarrow-up1·1 hour 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.
Lua might have been a better choice, since
self
is special in lua.Kinda.
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.