[Lua-icxx-users] Difficulty reading a std::string from a LuaTempResult
Brought to you by:
schoenborno
From: Jon <pen...@gm...> - 2011-12-07 22:50:54
|
Hello. I'm experimenting with lua_icxx to see how helpful it might be. I'm having trouble with this code: LuaTempResult ltr = _interpreter_ptr->eval( "return 'test'" ); std::string ret = ltr[ 1 ]; Based on the examples provided it seems it should work. However, I get the compiler error: >c:\users\jon\documents\visual studio 2010\projects\dron\dron\script\script.cpp(29): error C2440: 'initializing' : cannot convert from 'LuaTempResult::Item' to 'std::basic_string<_Elem,_Traits,_Ax>' 1> with 1> [ 1> _Elem=char, 1> _Traits=std::char_traits<char>, 1> _Ax=std::allocator<char> 1> ] 1> No constructor could take the source type, or constructor overload resolution was ambiguous When I change the code somewhat, I get an error better describing the ambiguity: 1>c:\users\jon\documents\visual studio 2010\projects\dron\dron\script\script.cpp(27): error C2593: 'operator =' is ambiguous 1> c:\program files (x86)\microsoft visual studio 10.0\vc\include\xstring(772): could be 'std::basic_string<_Elem,_Traits,_Ax> &std::basic_string<_Elem,_Traits,_Ax>::operator =(_Elem)' 1> with 1> [ 1> _Elem=char, 1> _Traits=std::char_traits<char>, 1> _Ax=std::allocator<char> 1> ] 1> c:\program files (x86)\microsoft visual studio 10.0\vc\include\xstring(767): or 'std::basic_string<_Elem,_Traits,_Ax> &std::basic_string<_Elem,_Traits,_Ax>::operator =(const _Elem *)' 1> with 1> [ 1> _Elem=char, 1> _Traits=std::char_traits<char>, 1> _Ax=std::allocator<char> 1> ] 1> c:\program files (x86)\microsoft visual studio 10.0\vc\include\xstring(762): or 'std::basic_string<_Elem,_Traits,_Ax> &std::basic_string<_Elem,_Traits,_Ax>::operator =(const std::basic_string<_Elem,_Traits,_Ax> &)' 1> with 1> [ 1> _Elem=char, 1> _Traits=std::char_traits<char>, 1> _Ax=std::allocator<char> 1> ] 1> c:\program files (x86)\microsoft visual studio 10.0\vc\include\xstring(707): or 'std::basic_string<_Elem,_Traits,_Ax> &std::basic_string<_Elem,_Traits,_Ax>::operator =(std::basic_string<_Elem,_Traits,_Ax> &&)' 1> with 1> [ 1> _Elem=char, 1> _Traits=std::char_traits<char>, 1> _Ax=std::allocator<char> 1> ] 1> while trying to match the argument list '(std::string, LuaTempResult::Item)' Am I doing something wrong? How can I get this to work? Thanks Jon. |