void fileAllocate(WrenVM* vm) { // Store the file descriptor in the foreign data, so that we can get to it // in the finalizer. int* fd = (int*)wrenSetSlotNewForeign(vm, 0, 0, sizeof(int)); *fd = (int)wrenGetSlotDouble(vm, 1); }
static void foreignClassAllocate(WrenVM* vm) { wrenSetSlotNewForeign(vm, 0, 0, 4); }
static void counterAllocate(WrenVM* vm) { double* counter = (double*)wrenSetSlotNewForeign(vm, 0, 0, sizeof(double)); *counter = wrenGetSlotDouble(vm, 1); }