Parenthesis serve two functions in Lua, both of which are also found in mathematics with this notation!
1. Grouping operations, to evaluated in an order other than PEMDAS, e.g., x * (y + a) is not the same as (x * y) + a.
2. Function application, like in sin(x) in mathematics. Lua uses the same convention of <functionname>(<functionparameters>). Juxtaposing a value with parenthesis in Lua always means function application, not multiplication:
(x+1)(x+2) does NOT mean (x+1)*(x+2). It means apply (x+2) to the function (x+1) (which would only run without errors with strange metamethods).
They also appear in definitions of functions, although in that case it's a syntactic structure rather than actual application!
In the specific example you gave, we call that a method call instead of a function call because it acts slightly different, but operation is almost exactly the same:
a:b(c) is the same thing as a.b(a,c) (which is a regular function call).
2 comments
+1 Because of breaking bad reference
Hi if you are reading this can you help me in this script? https://scriptinghelpers.org/questions/27135/script-wont-work