Orxonox
0.0.5 Codename: Arcturus
|
Makes certain functions visible to lua while staying type-safe on the C++ side. More...
#include </home/jenkins/workspace/orxonox_doxygen_trunk/src/orxonox/scriptablecontroller/luatb.h>
Static Public Member Functions | |
template<FunctionType func> | |
static void | registerFunction (ThisType *_this, lua_State *lua, std::string name) |
Make a function visible to lua. More... | |
Makes certain functions visible to lua while staying type-safe on the C++ side.
|
static |
Make a function visible to lua.
_this | Pointer to the object that owns the function |
lua | Pointer to the lua state |
name | Name that will be visible to lua for this function |
Only class functions are supported, because that's all we need at the moment. Extending it to support normal functions as well should be fairly easy, though.
If you want to make a function 'Foo::bar' visible, you should call it like this (assuming no C++17 support):
LuaTB<Foo, decltype(&Foo::bar)>::registerFunction<&Foo::bar>( ... );