I'am trying to get a variable out of my config.lua file with c++. I've created a Lua-Class from a tutorial to get these variable but I'am getting an error when I try to call the function who gets the variable from config.lua
here are the code snippets:
LuaScript script("config.lua");
script.get(string("test"));
I'am getting the error, "no instance of function template matches the argument list", at the point where I call "script.get(string("test));"
the template function and specialization looks like this:
template<typename T>
T get( const std::string &variableName )
{
if (!L)
{
printError(variableName, "Script not loaded");
return lua_getdefault<T>();
}
T result;
if (lua_gettostack(variableName))
{
result = lua_get<T>(variableName);
}else{
result = lua_getdefault<T>();
}
clean();
return result;
}
the specialization:
template<>
inline std::string LuaScript::lua_get<std::string>( const std::string &variableName )
{
std::string s = "null";
if (lua_isstring(L, -1))
{
s = std::string(lua_tostring(L, -1));
}else{
printError(variableName, "Not a string");
}
return s;
}
Just for some more information, I'am coding and compiling with Visual Studio 2012.
thanks for your help :)