You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is it possible to bind a C++ member function (or closure, for that matter) to a static Wren method? I can't figure out a way to get any sort of instance state inside those function bindings. (For example, if I wanted to bind a Wren function to close a window, I'd need access to the window handle from a closure scope or member variable)
The text was updated successfully, but these errors were encountered:
You could try binding a Cfunction. It's a raw WrenForeignMethodFn (which is all that Wren sees of your class methods, see src/include/wren.h in the Wren repo) that you can bind to a class by doing vm.beginModule("main").beginClass("Test").bindCFunction(true, &wren_count, "count()");.
Adding wrappers for lambdas is probably something I should add to my TO-DO list, since it's a bit unfortunate to have to write this sort of boiler-plate code manually.
Is it possible to bind a C++ member function (or closure, for that matter) to a static Wren method? I can't figure out a way to get any sort of instance state inside those function bindings. (For example, if I wanted to bind a Wren function to close a window, I'd need access to the window handle from a closure scope or member variable)
The text was updated successfully, but these errors were encountered: