Orxonox  0.0.5 Codename: Arcturus
Static Public Member Functions | List of all members
LuaTB< ThisType, FunctionType > Class Template Reference

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...
 

Detailed Description

template<typename ThisType, typename FunctionType>
class LuaTB< ThisType, FunctionType >

Makes certain functions visible to lua while staying type-safe on the C++ side.

Member Function Documentation

template<typename ThisType , typename FunctionType >
template<FunctionType func>
static void LuaTB< ThisType, FunctionType >::registerFunction ( ThisType *  _this,
lua_State *  lua,
std::string  name 
)
static

Make a function visible to lua.

Parameters
_thisPointer to the object that owns the function
luaPointer to the lua state
nameName 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>( ... );


The documentation for this class was generated from the following file: