I'm trying to create a clean binding between my Lua and C++ code, and thanks to tolua++ (and some great help from Ariel Manzur), I think I've just about got it.
The one thing that's irking me, however, is C++ related.
I'd like to have a syntax from C++ that looks like this:
myLuaInterpreterClass.CallLuaFunction("luafunctionname", ...);
Where ... is zero or more parameters, of possibly varying types.
Now, the inside of that function is going to call to various lua functions to set the state and push the actual variable *into* Lua, but it needs to use it's type to determine what to do.
I think I'm hosed, or at least I'll have to do some crazy nasty shit with templates to get it to work. Does anyone have any other ideas? Currently all I'm thinking is something like this:
class LuaInterpreter
{
public:
void CallLuaFunction(const std::string& funcName);
template<typename T>
void CallLuaFunction(const std::string& funcName, const T& param1);
template<typename T, typename T1>
void CallLuaFunction(const std::string& funcName, const T& param1, const T1& param2);
template<typename T, typename T1, typename T2>
void CallLuaFunction(const std::string& funcName, const T& param1, const T1& param2, const T2& param3);
// ... etc, etc.
};
I've done this before using Boost::PreProcessor, and it's yukky, but it works...
Anyways, perhaps I'm just rambling. Let me know if this makes sense. :D












