Generate wrenAllocateForeign() to match the other setSlot methods.

Thanks, Michel!
This commit is contained in:
Bob Nystrom
2016-01-24 09:25:04 -08:00
parent 71e2458a6c
commit fde6cfc142
5 changed files with 31 additions and 28 deletions
+3 -3
View File
@@ -12,7 +12,7 @@ static void apiFinalized(WrenVM* vm)
static void counterAllocate(WrenVM* vm)
{
double* value = (double*)wrenAllocateForeign(vm, sizeof(double));
double* value = (double*)wrenSetSlotNewForeign(vm, 0, 0, sizeof(double));
*value = 0;
}
@@ -32,7 +32,7 @@ static void counterValue(WrenVM* vm)
static void pointAllocate(WrenVM* vm)
{
double* coordinates = (double*)wrenAllocateForeign(vm, sizeof(double[3]));
double* coordinates = (double*)wrenSetSlotNewForeign(vm, 0, 0, sizeof(double[3]));
// This gets called by both constructors, so sniff the slot count to see
// which one was invoked.
@@ -69,7 +69,7 @@ static void pointToString(WrenVM* vm)
static void resourceAllocate(WrenVM* vm)
{
int* value = (int*)wrenAllocateForeign(vm, sizeof(int));
int* value = (int*)wrenSetSlotNewForeign(vm, 0, 0, sizeof(int));
*value = 123;
}