1
0
forked from Mirror/wren
Files
wren/test/api/value.c
Bob Nystrom 4b3c818ec5 Start moving embedding API towards "slot" register-API.
- wrenGetArgumentCount() -> wrenGetSlotCount()
- wrenGetArgument___() -> wrenGetSlot___()

Also, the get functions assert that the value is the right type instead
of checking at runtime. This puts the onus on the caller to be safe,
but maximizes performance.
2015-12-16 10:22:42 -08:00

25 lines
460 B
C

#include <string.h>
#include "value.h"
static WrenValue* value;
static void setValue(WrenVM* vm)
{
value = wrenGetSlotValue(vm, 1);
}
static void getValue(WrenVM* vm)
{
wrenReturnValue(vm, value);
wrenReleaseValue(vm, value);
}
WrenForeignMethodFn valueBindMethod(const char* signature)
{
if (strcmp(signature, "static Value.value=(_)") == 0) return setValue;
if (strcmp(signature, "static Value.value") == 0) return getValue;
return NULL;
}