Conversation
|
Perfect. This looks very useful for passing around state or context. Does this also work with |
yes it does, everywhere we expect a callable. What do you mean by |
|
So in my use case, I keep That's one way to do it. I could keep the global of draw API, and ignore the calls, by doing checks in C++, but that would be incredibly verbose. Another way would be if I could store |
|
You can take advantage of the namespaces but still register them as tables, see this: lua_newtable (L);
luabridge::getNamespaceFromStack (L)
.addFunction ("test", +[] (int x) { return x; })
.addFunction ("bar", &bar);
lua_setglobal (L, "draw"); |
This pull request introduces support for partial function application in LuaBridge via a new
luabridge::bind_frontutility, making it easier to register partially applied functions with automatic type deduction. The documentation and test suite have been updated accordingly, and several enhancements have been made to function trait detection and callable support.Enhancements to Partial Application and Function Registration:
luabridge::bind_front, a drop-in replacement forstd::bind_frontthat allows partial application of function arguments with automatic deduction of remaining parameter types, enabling easier and more concise registration of bound functions in LuaBridge.Manual.md) to describe and provide examples forluabridge::bind_front, including its advantages overstd::bind_frontand usage with member functions. [1] [2]Improvements to Callable and Function Trait Detection:
FuncTraits.hto better support functors, lambdas, and objects with custom call operators, improving robustness and flexibility when registering different callable types. [1] [2] [3]Testing and Build System Updates:
NamespaceTests.cppto verify correct behavior of bothstd::bind_frontandluabridge::bind_frontwith various function signatures, ensuring correctness and coverage of the new feature. [1] [2]justfile) to include convenient targets for opening the project, building, and running tests.