what does .new do in functions like for example:
function blah.new()
end
what does .new do in functions like for example:
function blah.new()
end
:
and .
are called method calls.
They are mainly used in modules.
The only difference is that :
passes self
as its first parameter.
function something.whatever()
is just making a function (whatever) in a table (something). It doesn’t have anything to do with modules.
I personally use them in modules, however they don’t have to be used by one.