diff --git a/src/main.cpp b/src/main.cpp index 7c71ae7..ce694a9 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -19,6 +19,7 @@ #include #include #include +#include #include #include @@ -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(); - 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); vm.interpret("main", g_script); wren::call(vm, {"main", "the_app"}, "start"); diff --git a/subprojects/wrenpp b/subprojects/wrenpp index d985ebc..258237c 160000 --- a/subprojects/wrenpp +++ b/subprojects/wrenpp @@ -1 +1 @@ -Subproject commit d985ebc417f80c59fe26200a9e1e677f54ccb9e9 +Subproject commit 258237cbf3b070f31defd5d5976bb96277ac9f65