Why am I zero? How should I do it?
2 answers
function foo:bar() ... end
quietly injects a parameter with a name self
as the first argument, making it equivalent function foo.bar(self) ... end
. This is not like Javascript, where there is a magic variable this
that just exists.
The second line should be:
a = function(self) print(self) end
+3
source to share