Tweaked truthiness, fixed int to float coersion

This commit is contained in:
2025-02-02 16:38:46 +11:00
parent 63cc530899
commit 336616a1bf
3 changed files with 98 additions and 0 deletions

View File

@@ -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;
}