forked from Mirror/wren
Merge branch 'master' of https://github.com/munificent/wren
This commit is contained in:
2
Makefile
2
Makefile
@ -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
|
||||
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user