The input operator >>
extracts only until the next whitespace. Either use std::getline
or the stringstream::str
function to get the string.
My recommendation is to change to std::ostringstream
and use std::ostringstream::str
:
std::ostringstream oss;
oss << "lua error code " << iErr << ": " << lua_tostring(lua, -1);
Log *log= StandardLog::getInstance();
log->logError("Lua error following in next line");
log->logError(oss.str());