diff --git a/include/wrenpp/vm_fun.hpp b/include/wrenpp/vm_fun.hpp index a2b3ee2..f580a59 100644 --- a/include/wrenpp/vm_fun.hpp +++ b/include/wrenpp/vm_fun.hpp @@ -83,6 +83,8 @@ namespace wren { template T* foreign (VM& vm, int slot_num); void variable(VM& vm, const ModuleAndName& mod_and_name, int slot); void variable(VM& vm, const Handle& handle, int slot); + void variable_ensure_slot(VM& vm, const ModuleAndName& mod_and_name, int slot); + void variable_ensure_slot(VM& vm, const Handle& handle, int slot); namespace detail { template struct TType { typedef T type; }; diff --git a/src/vm_fun.cpp b/src/vm_fun.cpp index bd2855b..57fb118 100644 --- a/src/vm_fun.cpp +++ b/src/vm_fun.cpp @@ -79,4 +79,14 @@ namespace wren { void variable (VM& vm, const Handle& handle, int slot) { vm.set_slot_handle(handle, slot); } + + void variable_ensure_slot(VM& vm, const ModuleAndName& mod_and_name, int slot) { + vm.ensure_slots(1); + variable(vm, mod_and_name, slot); + } + + void variable_ensure_slot (VM& vm, const Handle& handle, int slot) { + vm.ensure_slots(1); + variable(vm, handle, slot); + } } //namespace wren