You're viewing a single thread.
All comments
68
comments
In Python, self is not a keyword, it’s a conventional variable name. You can replace all instances of “self” with “this” and your code will work the same.
47 0 ReplyLua might have been a better choice, since
self
is special in lua.8 0 ReplyKinda.
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 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.Edit: some typos
6 0 ReplyI 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.
3 0 ReplyDerp, I misread.
2 0 Reply
Python is just distancing itself from JS.
7 0 Reply
68
comments
Scroll to top