I am attempting to run a javascript function using the ScriptRunner class and get an exception if the number of arguments passed in as the second parameter of the RunFunction does not match the number of arguments expected in the javascript function I am attempting to execute. Is there a way for the ScriptRunner class to determine how many parameters the javascript function expects before the RunFunction procedure is called?
For instance I want to be able to do something like this:
ScriptRunner scriptRunner;
// Set up scriptRunner object
int num_of_parameters = scriptRunner.GetFunctionParametersCount(“Main”);
if(calculationArgsObjectList.Count == num_of_parameters)
{
scriptRunner.RunFunction(“Main”, calculationArgsObjectList.ToArray());
}
else
{
// Log error that an an incorrect number of arguments have been supplied to the “Main” function.
}