Can you asked for a typed Array / 2D Array as an argument?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By ilog

I know that it is possible to export a typed array with
but can you ask for one as an argument of a function?

for example :

func Shoot(bullets : Array,int):

:bust_in_silhouette: Reply From: Ertain

If you are asking whether the data type of the elements in an array can be specified, no they cannot. In current the stable version of the engine (e.g. 3.5) the data type of the individual elements of an array can’t be declared. IIRC, in Godot 4 they can be.

In the meantime (until Godot 4 is released), why not try using PoolIntArray for the argument? While it may have setbacks, all of the elements of the array are only integers.