Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide access to wrenGetVariable() and wrenGetSlotHandle() #173

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 5 additions & 0 deletions docs/plugins/index.md
Expand Up @@ -274,6 +274,11 @@ const char* getSlotBytes(WrenVM* vm, int slot, int* length);
void getMapValue(WrenVM* vm, int mapSlot, int keySlot, int valueSlot);
void setMapValue(WrenVM* vm, int mapSlot, int keySlot, int valueSlot);
void removeMapValue(WrenVM* vm, int mapSlot, int keySlot, int removedValueSlot);

void getVariable(WrenVM* vm, const char* module, const char* name, int slot);
WrenHandle* getSlotHandle(WrenVM* vm, int slot);
void setSlotHandle(WrenVM* vm, int slot, WrenHandle* handle);
void releaseHandle(WrenVM* vm, WrenHandle* handle);
```

## Audio
Expand Down
6 changes: 6 additions & 0 deletions include/dome.h
Expand Up @@ -59,6 +59,7 @@ typedef enum {
#ifndef wren_h
// If the wren header is not in use, we forward declare some types we need.
typedef struct WrenVM WrenVM;
typedef struct WrenHandle WrenHandle;
typedef void (*WrenForeignMethodFn)(WrenVM* vm);
typedef void (*WrenFinalizerFn)(void* data);

Expand Down Expand Up @@ -127,6 +128,11 @@ typedef struct {
void (*getMapValue)(WrenVM* vm, int mapSlot, int keySlot, int valueSlot);
void (*setMapValue)(WrenVM* vm, int mapSlot, int keySlot, int valueSlot);
void (*removeMapValue)(WrenVM* vm, int mapSlot, int keySlot, int removedValueSlot);

void (*getVariable)(WrenVM* vm, const char* module, const char* name, int slot);
WrenHandle* (*getSlotHandle)(WrenVM* vm, int slot);
void (*setSlotHandle)(WrenVM* vm, int slot, WrenHandle* handle);
void (*releaseHandle)(WrenVM* vm, WrenHandle* handle);
} WREN_API_v0;

typedef struct {
Expand Down
7 changes: 6 additions & 1 deletion src/plugin.c
Expand Up @@ -318,7 +318,12 @@ WREN_API_v0 wren_v0 = {
.getMapContainsKey = wrenGetMapContainsKey,
.getMapValue = wrenGetMapValue,
.setMapValue = wrenSetMapValue,
.removeMapValue = wrenRemoveMapValue
.removeMapValue = wrenRemoveMapValue,

.getVariable = wrenGetVariable,
.getSlotHandle = wrenGetSlotHandle,
.setSlotHandle = wrenSetSlotHandle,
.releaseHandle = wrenReleaseHandle
};

DOME_API_v0 dome_v0 = {
Expand Down