I want to print the properties and methods of a class into the console with GDScript. In Python, this can be done with the print(dir(variable)) method.
Is there an analogous function in GDScript?
I made my own dir function and it works OK.
func dir(class_instance):
var output = {}
var methods = []
for method in class_instance.get_method_list():
methods.append(method.name)
output["METHODS"] = methods
var properties = []
for prop in class_instance.get_property_list():
if prop.type == 3:
properties.append(prop.name)
output["PROPERTIES"] = properties
return output