Material Box

Material Box

WEB Design & Material Images

Godot - Check if variable is array

Godot

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")

Godot

TitleGodot - Check if variable is array

CategoryGodot

Created

Update

AuthorYousuke.U