Allow booleanization of all types

We now allow booleanization of all types. This means that empty versions
of all types now evaluate to false. So a Vector2(0,0), Dictionary(),
etc.

This allows you to write GDScript like:
if not Dictionary():
  print("Empty dict")

Booleanization can now also no longer fail. There is no more valid flag,
this changes Variant and GDNative API.
This commit is contained in:
Hein-Pieter van Braam
2017-09-18 20:02:47 +02:00
parent 85641c545b
commit 833c3917b2
6 changed files with 20 additions and 105 deletions

View File

@ -390,7 +390,7 @@ public:
uint32_t hash() const;
bool hash_compare(const Variant &p_variant) const;
bool booleanize(bool &valid) const;
bool booleanize() const;
void static_assign(const Variant &p_variant);
static void get_constructor_list(Variant::Type p_type, List<MethodInfo> *p_list);