Add arbitrary method to foreign_method_t conversion helper

It might not work in every case, you still are restricted
to types that set() and get() understand.
This commit is contained in:
King_DuckZ 2020-05-03 12:23:06 +02:00
commit 6a30725a62
3 changed files with 49 additions and 2 deletions

View file

@ -54,6 +54,10 @@ namespace wren {
return static_cast<int>(vm.slot_double(slot_num));
}
template<> std::size_t get<std::size_t> (VM& vm, int slot_num) {
return static_cast<std::size_t>(vm.slot_double(slot_num));
}
template<> std::string get<std::string> (VM& vm, int slot_num) {
return {vm.slot_string(slot_num)};
}