Added 'min' and 'max' as standard functions

Also fixed floating point printing with sprintf
This commit is contained in:
2026-05-27 10:52:06 +10:00
parent f2b714baaa
commit 3e115095d6
13 changed files with 86 additions and 59 deletions
+2 -2
View File
@@ -546,7 +546,7 @@ static void processIterate(Toy_VM* vm) {
processJump(vm);
}
}
//TODO: support closures as a parameter
//TODO: support closures in for-loops
else {
fprintf(stderr, TOY_CC_ERROR "ERROR: Unknown iterable type '%s' found in for loop, exiting\n" TOY_CC_RESET, Toy_getValueTypeAsCString(Toy_unwrapValue(compound).type));
exit(-1);
@@ -826,7 +826,7 @@ static void processAssert(Toy_VM* vm) {
//determine the args
if (count == 1) {
message = TOY_VALUE_FROM_STRING(Toy_toString(&vm->memoryBucket, "assertion failed")); //TODO: better default error message
message = TOY_VALUE_FROM_STRING(Toy_toString(&vm->memoryBucket, "assertion failed")); //TODO: better default assert message
value = Toy_popStack(&vm->stack);
}
else if (count == 2) {