Space::to_bool() return true now when a string/object or table is non empty
This commit is contained in:
parent
c54c398828
commit
5eff9a5f4f
|
@ -827,8 +827,31 @@ bool Space::to_bool() const
|
||||||
if( type == type_bool )
|
if( type == type_bool )
|
||||||
return value.value_bool;
|
return value.value_bool;
|
||||||
|
|
||||||
long long val = to_long_long();
|
if( type == type_long )
|
||||||
return (val != 0) ? true : false;
|
return value.value_long != 0;
|
||||||
|
|
||||||
|
if( type == type_float )
|
||||||
|
return value.value_float != 0.0f;
|
||||||
|
|
||||||
|
if( type == type_double )
|
||||||
|
return value.value_double != 0.0;
|
||||||
|
|
||||||
|
if( type == type_long_double )
|
||||||
|
return value.value_long_double != 0.0L;
|
||||||
|
|
||||||
|
if( type == type_string )
|
||||||
|
return !value.value_string.empty();
|
||||||
|
|
||||||
|
if( type == type_wstring )
|
||||||
|
return !value.value_wstring.empty();
|
||||||
|
|
||||||
|
if( type == type_table )
|
||||||
|
return !value.value_table.empty();
|
||||||
|
|
||||||
|
if( type == type_object )
|
||||||
|
return !value.value_object.empty();
|
||||||
|
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
short Space::to_short() const
|
short Space::to_short() const
|
||||||
|
|
Loading…
Reference in New Issue