Code:
Turbine.Engine.GetLocale();
Turbine.Engine:GetLocale();
Since the function takes no arguments, the two are effectively the same. In the second case,
Turbine.Engine is implicitly passed as the first argument. So, the following two are exactly equivalent:
Code:
Turbine.Engine:GetLocale();
Turbine.Engine.GetLocale(Turbine.Engine);
There is a corresponding shorthand that can be used when defining functions. From
the Lua 5.1 manual:
Quote:
The colon syntax is used for defining methods, that is, functions that have an implicit extra parameter self. Thus, the statementfunction t.a.b.c:f (params) body end is syntactic sugar forfunction t.a.b.c.f (self, params) body end
|