like this “func myfunc(arg1,arg2,arg3.........argn)” I can pass in any number of parameters

Unfortunately it appears there is no way to have unlimited arguments in GDScript right now. There is a open issue on the Github repository though, so perhaps it will be added in the future.

However, you can get a similar effect using a list. Here is an example that should do what you are looking for:

func print_everything(arguments=[]):
	for i in range(0, arguments.size()):
		var value = arguments[i];
		
		if (typeof(value) == TYPE_STRING):
			print ("String argument: ", value);
		else:
			print ("Argument " + str(i) + " :", arguments[i])

# Then to use it, you just pass the arguments in a list.
print_everything( ["Test", 42, Vector3(-3, 0, 0), false, {"Key":"Value"}, 3.14] )

The hardest part will be parsing the arguments in the way you need, but it should not be too hard if you do not need to mix and match the types passed in to the function.

Hopefully this helps :smile:

4 years later