왜이 코드 조각 않습니다 단지 인쇄이제 stringstream가 불완전하게 채워
if (iErr) {
std::stringstream ss;
string serror("error");
ss << "lua error code " << iErr << ": " << lua_tostring(lua, -1);
ss >> serror;
Log *log= StandardLog::getInstance();
log->logError("Lua error following in next line");
log->logError(serror);
//lua_pop(lua, 1);/* pop error message from the stack */
return 1;
}
:
Lua error following in next line
lua
대신
Lua error following in next line
lua error code 3: lua/generator/generator_example_nodenavigator.lua:10: attempt to call global 'require' (a nil value)
로거 라인
는 다음과 같다 :void Logger::log(char message[]){
string smessage(message);
log(smessage);
}
void Logger::log(string smessage){
...
}
,
하지만 로거는 오류가 없습니다. 왜냐하면 나는 cerr을 사용하여 동일한 출력을 얻었 기 때문입니다.