mirror of
https://github.com/krgamestudios/Toy.git
synced 2026-04-15 14:54:07 +10:00
Tweaked truthiness, fixed int to float coersion
This commit is contained in:
@@ -194,6 +194,14 @@ bool Toy_checkValueIsTruthy(Toy_Value value) {
|
||||
return value.as.boolean;
|
||||
}
|
||||
|
||||
if (value.type == TOY_VALUE_INTEGER) {
|
||||
return value.as.integer != 0;
|
||||
}
|
||||
|
||||
if (value.type == TOY_VALUE_FLOAT) {
|
||||
return value.as.number != 0.0f;
|
||||
}
|
||||
|
||||
//anything else is truthy
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user