diff --git a/src/wren/vm.cpp b/src/wren/vm.cpp index f1af1a3..5b953eb 100644 --- a/src/wren/vm.cpp +++ b/src/wren/vm.cpp @@ -188,6 +188,11 @@ namespace wren { return {data, length}; } + void* VM::slot_foreign (int slot_num) { + assert(SlotType::Foreign == slot_type(slot_num)); + return wrenGetSlotForeign(m_local->wvm, slot_num); + } + void VM::set_slot_string (int slot_num, const char* value) { wrenSetSlotString(m_local->wvm, slot_num, value); } @@ -208,6 +213,10 @@ namespace wren { wrenSetSlotBytes(m_local->wvm, slot_num, bytes, length); } + void* VM::set_slot_new_foreign (int slot_num, int class_slot, std::size_t size) { + return wrenSetSlotNewForeign(m_local->wvm, slot_num, class_slot, size); + } + void VM::ensure_slots (int num_slots) { wrenEnsureSlots(m_local->wvm, num_slots); } diff --git a/src/wren/vm.hpp b/src/wren/vm.hpp index a50213b..f239a0a 100644 --- a/src/wren/vm.hpp +++ b/src/wren/vm.hpp @@ -68,12 +68,14 @@ namespace wren { void set_slot_bool (int slot_num, bool value); void set_slot_null (int slot_num); void set_slot_bytes (int slot_num, const char* bytes, std::size_t length); + void* set_slot_new_foreign (int slot_num, int class_slot, std::size_t size); //slot getters const char* slot_string (int slot_num); double slot_double (int slot_num); bool slot_bool (int slot_num); std::pair slot_bytes (int slot_num); + void* slot_foreign (int slot_num); private: struct LocalData;