Posted at: 2015-02-19, 18:28
I have read the tutorial linked there when I was creating the tutorials. What is still unclear to me: How do I know/find out whether I have to use
p.func(a) and when
p:func(a) other than by trial-and-error or looking at examples in the code? That is, is there a way to document that in the .cc files from which the documentation is created? These docs are the place where I expect(ed) such things.
You need to use : if you call a method, i.e. a function defined in a class (most), you need to use . if you call a function. For example
g = wl.Game() -- creates a game class. This calls a method in the module 'wl'.
p = game.players -- gets the first entry of the players property of this class which is an array of Player classes. There is no function call here.
p:get_buildings("blub") -- same as p.get_buildings(p, "blub"), calls a method on the class P.