diff options
author | Andreas Haas <liu.gam3@gmail.com> | 2017-05-26 19:45:39 +0200 |
---|---|---|
committer | Andreas Haas <liu.gam3@gmail.com> | 2017-05-27 10:59:59 +0200 |
commit | 015d36d18bb3f9fe21452a470aac2c3a3597b92f (patch) | |
tree | 5aa84e4c0f731fb0b788509a3da700513614957a /modules/gdscript/gd_function.cpp | |
parent | f89641907f8b45941f5e67891936ee8050a3ef92 (diff) | |
download | redot-engine-015d36d18bb3f9fe21452a470aac2c3a3597b92f.tar.gz |
GDScript: Use "is" keyword for type checking.
Replaces the `extends` keyword with `is` in the context of testing for type compatibility.
`extends` is still used for declaring class inheritance.
Example:
```gdscript
extends Node2D
func _input(ev):
if ev is InputEventKey:
print("yay, key event")
```
Diffstat (limited to 'modules/gdscript/gd_function.cpp')
-rw-r--r-- | modules/gdscript/gd_function.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/modules/gdscript/gd_function.cpp b/modules/gdscript/gd_function.cpp index fb32d23ad5..e8a8e20927 100644 --- a/modules/gdscript/gd_function.cpp +++ b/modules/gdscript/gd_function.cpp @@ -358,12 +358,12 @@ Variant GDFunction::call(GDInstance *p_instance, const Variant **p_args, int p_a if (a->get_type() != Variant::OBJECT || a->operator Object *() == NULL) { - err_text = "Left operand of 'extends' is not an instance of anything."; + err_text = "Left operand of 'is' is not an instance of anything."; break; } if (b->get_type() != Variant::OBJECT || b->operator Object *() == NULL) { - err_text = "Right operand of 'extends' is not a class."; + err_text = "Right operand of 'is' is not a class."; break; } #endif @@ -401,7 +401,7 @@ Variant GDFunction::call(GDInstance *p_instance, const Variant **p_args, int p_a if (!nc) { - err_text = "Right operand of 'extends' is not a class (type: '" + obj_B->get_class() + "')."; + err_text = "Right operand of 'is' is not a class (type: '" + obj_B->get_class() + "')."; break; } |