1
0
forked from Mirror/wren
This commit is contained in:
Bob Nystrom
2015-01-18 10:20:29 -08:00
3 changed files with 15 additions and 1 deletions

View File

@ -20,7 +20,7 @@ DEBUG_LIB_OBJECTS = $(subst build/debug/main.o,,$(DEBUG_OBJECTS))
RELEASE_LIB_OBJECTS = $(subst build/release/main.o,,$(RELEASE_OBJECTS))
RELEASE_CPP_LIB_OBJECTS = $(subst build/release-cpp/main.o,,$(RELEASE_CPP_OBJECTS))
.PHONY: all clean test builtin docs watchdocs
.PHONY: all clean test builtin docs watchdocs prep
all: release

View File

@ -3,6 +3,7 @@
#include <stdlib.h>
#include <stdint.h>
#include <stdbool.h>
typedef struct WrenVM WrenVM;
@ -148,4 +149,9 @@ void wrenReturnNull(WrenVM* vm);
// [text] will be calculated using `strlen()`.
void wrenReturnString(WrenVM* vm, const char* text, int length);
// Provides a boolean return value for a foreign call. This must only be called
// within a function provided to [wrenDefineMethod]. Once this is called, the
// foreign call is done, and no more arguments can be read or return calls made.
void wrenReturnBool(WrenVM* vm, bool value);
#endif

View File

@ -1236,3 +1236,11 @@ void wrenReturnString(WrenVM* vm, const char* text, int length)
*vm->foreignCallSlot = wrenNewString(vm, text, size);
vm->foreignCallSlot = NULL;
}
void wrenReturnBool(WrenVM* vm, bool value)
{
ASSERT(vm->foreignCallSlot != NULL, "Must be in foreign call.");
*vm->foreignCallSlot = BOOL_VAL(value);
vm->foreignCallSlot = NULL;
}