How to determine the type of a variable?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By alexzheng
:warning: Old Version Published before Godot 3 was released.

For object inherited from Object, there is a API is_type,
but for built-in types, such as Array, how can I determine the variable is an Array?

:bust_in_silhouette: Reply From: kidscancode

gdscript has typeof():

This will give you a result of TYPE_ARRAY (for example). TYPE_* codes are listed here: @Global Scope — Godot Engine (2.1) documentation in English

Thanks, that’s exactly what I looking for.

alexzheng | 2017-09-02 01:16

Also relevant: https://forum.godotengine.org/2849/how-do-i-get-instanceof-an-object

aggregate1166877 | 2020-06-30 01:37