std::string key = std::string(luaL_checkstring(L, 2));
const char* value = luaL_checkstring(L, 3);
- o->m_settings->set(key, value);
+ o->m_settings->set(Settings::sanitizeString(key), value);
return 1;
}
}
+std::string Settings::sanitizeString(const std::string &value)
+{
+ std::string str = value;
+ for (const char *s = "\t\n\v\f\r\b =\""; *s; s++)
+ str.erase(std::remove(str.begin(), str.end(), *s), str.end());
+
+ return str;
+}
+
+
std::string Settings::getMultiline(std::istream &is)
{
std::string value;
const std::string &end, u32 tab_depth=0);
static std::string getMultiline(std::istream &is);
+ static std::string sanitizeString(const std::string &value);
static void printValue(std::ostream &os, const std::string &name,
const SettingsEntry &entry, bool is_value_multiline, u32 tab_depth=0);