Changeset 11673 for code/branches/ScriptableController_HS17/src/orxonox/scriptablecontroller/luatb.h
- Timestamp:
- Dec 14, 2017, 4:04:14 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/ScriptableController_HS17/src/orxonox/scriptablecontroller/luatb.h
r11549 r11673 6 6 struct lua_State; 7 7 8 // Makes certain functions visible to lua while staying type-safe on the 9 // C++ side. 8 /** 9 * @brief Makes certain functions visible to lua while staying type-safe 10 * on the C++ side. 11 */ 10 12 template<typename ThisType, typename FunctionType> 11 13 class LuaTB 12 14 { 13 15 public: 14 // Make a function visible to lua. If you want to make a function 'foo' 15 // visible, you should call it like this: 16 // 17 // LuaTB<decltype(foo)>::registerFunction<foo>( ... ); 16 /** 17 * @brief Make a function visible to lua 18 * @param _this Pointer to the object that owns the function 19 * @param lua Pointer to the lua state 20 * @param name Name that will be visible to lua for this function 21 * 22 * Only class functions are supported, because that's all we need at 23 * the moment. Extending it to support normal functions as well should 24 * be fairly easy, though. 25 * 26 * If you want to make a function 'Foo::bar' visible, you should call 27 * it like this (assuming no C++17 support): 28 * 29 * LuaTB<Foo, decltype(&Foo::bar)>::registerFunction<&Foo::bar>( ... ); 30 */ 18 31 template<FunctionType func> 19 32 static void registerFunction(ThisType *_this, lua_State *lua, std::string name); … … 21 34 22 35 // We need to include all type-dependant template implementations, because the 23 // compiler needs to know for which types it has to instantiate those 36 // compiler needs to know for which types it has to instantiate those. 24 37 #include "luatb.ipp" 25 38
Note: See TracChangeset
for help on using the changeset viewer.