Settings: Disallow space characters entirely

Lua API:
> Setting names can't contain whitespace or any of ="{}#
This commit is contained in:
SmallJoker 2019-06-10 18:17:57 +02:00 committed by sfan5
parent e2f8f4da83
commit f1f9361bc8

@ -69,7 +69,9 @@ Settings & Settings::operator = (const Settings &other)
bool Settings::checkNameValid(const std::string &name)
{
bool valid = name.find_first_of("=\"{}#") == std::string::npos;
if (valid) valid = trim(name) == name;
if (valid)
valid = std::find_if(name.begin(), name.end(), ::isspace) == name.end();
if (!valid) {
errorstream << "Invalid setting name \"" << name << "\""
<< std::endl;