[-] Fixed crash with game saving

This commit is contained in:
cybermind 2015-03-05 22:21:10 +05:00
parent c29dbfa6a1
commit 6bf8030875

View file

@ -2195,13 +2195,17 @@ static bool LuaValueToString(lua_State *l, std::string &value)
const std::string s = lua_tostring(l, -1);
value = "";
for (std::string::const_iterator it = s.begin(); it != s.end(); ++it) {
if (*it == '\"') {
value.push_back('\\');
if ((s.find('\n') != std::string::npos)) {
value = std::string("[[") + s + "]]";
} else {
for (std::string::const_iterator it = s.begin(); it != s.end(); ++it) {
if (*it == '\"') {
value.push_back('\\');
}
value.push_back(*it);
}
value.push_back(*it);
value = std::string("\"") + value + "\"";
}
value = ((value.find('\n') != std::string::npos) ? (std::string("[[") + value + "]]") : (std::string("\"") + value + "\""));
return true;
}
case LUA_TTABLE: