fun2(params.maxindex() ? params* : 0)
Not supported.
* must be applied to the function call, not the array, and therefore must be next to the parenthesis.
As the parameters are mandatory AHK cannot call the function but it is also not showing any errors so I was left wondering what was going on... I think an error here should be displayed (same as when you try to call a function without the needed params)
The behaviour is the same as for failed dynamic function calls and most other expression errors which occur at runtime. The error message indicating you have passed too few parameters is displayed before the script even starts; at that point, it is impossible to know how many parameters will be passed in a variadic call.
If the function cannot be called due to one of the reasons below, the evaluation of the expression containing the call stops silently and prematurely, which may lead to inconsistent results:
[*:1xirs6ej]Calling a nonexistent function, which can be avoided by using If IsFunc(VarContainingFuncName). Except for built-in functions, the called function's definition must exist explicitly in the script by means such as #Include or a non-dynamic call to a library function.
[*:1xirs6ej]Passing too few parameters, which can be avoided by checking IsFunc()'s return value (which is the number of mandatory parameters plus one). Note: In v1.0.48+, passing too many parameters is tolerated; each extra parameter is fully evaluated (including any calls to functions) and then discarded.
This will probably be changed in v2.