| Line | |
|---|
| 1 | #ifndef LUATB_H |
|---|
| 2 | #define LUATB_H |
|---|
| 3 | |
|---|
| 4 | #include <string> |
|---|
| 5 | |
|---|
| 6 | struct lua_State; |
|---|
| 7 | |
|---|
| 8 | // Makes certain functions visible to lua while staying type-safe on the |
|---|
| 9 | // C++ side. |
|---|
| 10 | template<typename ThisType, typename FunctionType> |
|---|
| 11 | class LuaTB |
|---|
| 12 | { |
|---|
| 13 | 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>( ... ); |
|---|
| 18 | template<FunctionType func> |
|---|
| 19 | static void registerFunction(ThisType *_this, lua_State *lua, std::string name); |
|---|
| 20 | }; |
|---|
| 21 | |
|---|
| 22 | // We need to include all type-dependant template implementations, because the |
|---|
| 23 | // compiler needs to know for which types it has to instantiate those |
|---|
| 24 | #include "luatb.ipp" |
|---|
| 25 | |
|---|
| 26 | #endif // LUATB_H |
|---|
Note: See
TracBrowser
for help on using the repository browser.