"points, colons, and self in Lua"
In LUA programming, the definition and invocation of functions are often encountered, sometimes called with a dot number, sometimes by colons.
Girl = {Money = $] Function girl.gotomarket (girl, Somemoney) Girl.money = Girl.money-somemoney End Girl.gotomarket (g IRL, +) print (Girl.money)
The method's point number definition and point number are called.
Boy = {Money = $] Function boy:gotomarket (somemoney) Self.money = Self.money-somemoney End Boy:gotomarket (+) PR Int (Boy.money)
A colon definition and a colon call are made above.
The above print results are all 100.
As you can see, the colon definition and the colon call are actually the same as the above effect, except that the first hidden argument is omitted, and the argument self points to the caller itself
We can also point a number to define a colon call, or a colon to define a point number to call
Such as:
Boy = {money = +} function Boy.gotomarket (self, somemoney) Self.money = Self.money-somemoney End Boy:gotomarket (10 0) Print (Boy.money)
Reference: Summary: The colon is just a function of omitting the first argument self, which points to the caller itself, and there is no other special place.
Points, colons, and self in Lua