Reputation: 601
In C++, I have a global variable named as g. I want to bind it as static function so that lua don't need to create a Global variable, and can call its member function as static function.
c++ code:
class Global
{
int test();
};
Global g;
lua code:
Global.test() // call g.test() in c++
I know the bind method, but it bind test as a member function. How can I bind the member function test as static method in lua?
module(L)
[
class_<Global>("Global")
.def("test", &Global::test)
];
Upvotes: 1
Views: 1052