+1 vote

I can do a setter and getter and just use has_method("getter"), but is there a more convenient way to just verify if the object has a variable?

asked May 4, 2016 in Engine by mateusak (1,071 points)

2 Answers

+4 votes
Best answer

You can check this with in keyword. Like for example:

if "varName" in get_parent(): print("varName is defined in parent!")
answered May 4, 2016 by kubecz3k (1,253 points)
selected May 5, 2016 by mateusak
+1 vote

Check my question here some time ago about the same subject: link

answered May 4, 2016 by tiernich (423 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.