[-] Fixed crash with game saving
This commit is contained in:
parent
c29dbfa6a1
commit
6bf8030875
1 changed files with 9 additions and 5 deletions
|
@ -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:
|
||||
|
|
Loading…
Reference in a new issue