Implemented native C functions called from Toy scripts

There's only example functions for now, but I'll add type-specific
functions later.
This commit is contained in:
2026-04-16 21:14:42 +10:00
parent 3a0f11ebb4
commit 88100b128a
8 changed files with 93 additions and 4 deletions

View File

@@ -419,7 +419,12 @@ static void processInvoke(Toy_VM* vm) {
}
break;
case TOY_FUNCTION_NATIVE:
case TOY_FUNCTION_NATIVE: {
//NOTE: arguments are on the stack, leave results on the stack
fn->native.callback(vm);
}
break;
default:
Toy_error("Can't call an unknown function type");
break;