You can't register member functions like this. What your are doing is like the following in C++:
Test_Class::shoot_a_bullet(134);
MSVC for example calls that "illegal call of non-static member function", and that's exactly what it is.
Look at the section Binding classes to Lua in the Luabind documentation for how to bind a class to Lua. You then need to create an object of this class and call the function on it e.g. with myobject:shoot_a_bullet(134)
in Lua (the :
being syntactic sugar for passing myobject
as first argument).
To see the error, you should first check the return value of luaL_dostring
. If it returns true
, the call failed. The message is pushed onto the Lua stack as as string, accessible with
lua_tostring(myLuaState, -1);
In this case it should be something like
No matching overload found, candidates:
void shoot_a_bullet(Test_Class&)
Explanation: When you register a member function as a free one, luabind adds an extra reference parameter at the front so that the method is actually called on the argument object passed for it.