Godot - Check if variable is array
GDScript code example to check if variable is array using typeof()
.
Can check if variable type is array using typeof()
in GDScript.
Check if return value of typeof()
matches "TYPE_ARRAY".
var array = ["apple" ,"banana", "lemon"]
if typeof(array) == TYPE_ARRAY :
print("It's an array")
else:
push_error("Not an array")