Use new ClassManager
This commit is contained in:
parent
ccd15301af
commit
418d0af70f
2 changed files with 4 additions and 12 deletions
14
src/main.cpp
14
src/main.cpp
|
@ -19,6 +19,7 @@
|
|||
#include <wrenpp/vm_fun.hpp>
|
||||
#include <wrenpp/def_configuration.hpp>
|
||||
#include <wrenpp/callback_manager.hpp>
|
||||
#include <wrenpp/class_manager.hpp>
|
||||
#include <utility>
|
||||
#include <algorithm>
|
||||
|
||||
|
@ -89,17 +90,6 @@ void exchange_ticker_price_bitcoinity_wren (wren::VM& vm) {
|
|||
|
||||
class MyWrenConfiguration : public wren::DefConfiguration {
|
||||
public:
|
||||
wren::foreign_class_t foreign_class_fn(
|
||||
wren::VM* vm,
|
||||
std::string_view module,
|
||||
std::string_view class_name
|
||||
) {
|
||||
if (module == "ticker_price" and class_name == "TickerPrice")
|
||||
return wren::make_foreign_class<duck::TickerPrice>();
|
||||
else
|
||||
return {nullptr, nullptr};
|
||||
}
|
||||
|
||||
char* load_module_fn(wren::VM* vm, std::string_view module_name) {
|
||||
std::string_view wren_code;
|
||||
|
||||
|
@ -132,6 +122,8 @@ int main() {
|
|||
.add_callback(false, "ticker_price", "TickerPrice", "currency", wren::make_method_bindable<&TickerPrice::currency>())
|
||||
.add_callback(false, "ticker_price", "TickerPrice", "is_valid", wren::make_method_bindable<&TickerPrice::is_valid>())
|
||||
.add_callback(false, "ticker_price", "TickerPrice", "exchange", wren::make_method_bindable<&TickerPrice::exchange>());
|
||||
vm.class_manager()
|
||||
.add_class_maker("ticker_price", "TickerPrice", &wren::make_foreign_class<duck::TickerPrice>);
|
||||
|
||||
vm.interpret("main", g_script);
|
||||
wren::call<void>(vm, {"main", "the_app"}, "start");
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit d985ebc417f80c59fe26200a9e1e677f54ccb9e9
|
||||
Subproject commit 258237cbf3b070f31defd5d5976bb96277ac9f65
|
Loading…
Reference in a new issue