2015-08-06 22:24:15 -07:00
|
|
|
#include <string.h>
|
|
|
|
|
|
2015-08-13 09:09:27 -07:00
|
|
|
#include "value.h"
|
2015-08-06 22:24:15 -07:00
|
|
|
|
|
|
|
|
static WrenValue* value;
|
|
|
|
|
|
|
|
|
|
static void setValue(WrenVM* vm)
|
|
|
|
|
{
|
|
|
|
|
value = wrenGetArgumentValue(vm, 1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void getValue(WrenVM* vm)
|
|
|
|
|
{
|
|
|
|
|
wrenReturnValue(vm, value);
|
|
|
|
|
wrenReleaseValue(vm, value);
|
|
|
|
|
}
|
|
|
|
|
|
2015-08-15 12:07:53 -07:00
|
|
|
WrenForeignMethodFn valueBindMethod(const char* signature)
|
2015-08-06 22:24:15 -07:00
|
|
|
{
|
|
|
|
|
if (strcmp(signature, "static Api.value=(_)") == 0) return setValue;
|
|
|
|
|
if (strcmp(signature, "static Api.value") == 0) return getValue;
|
|
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|