Allow WML tags with leading underscore (#3877)
@gfgtdf pointed out that the WML parser can deal with such tags after all.
I had missed that when I implemented the check that the game state is
valid WML before saving it (commit 3bc36efa58
).
Such tags are still disallowed in the Lua API because allowing them would
be an API change.
This commit is contained in:
parent
e0aa686ff2
commit
07bf003b79
2 changed files with 3 additions and 3 deletions
|
@ -186,8 +186,8 @@ bool config::valid_tag(config_key_type name)
|
|||
if(name == "") {
|
||||
// Empty strings not allowed
|
||||
return false;
|
||||
} else if(name[0] == '_') {
|
||||
// Underscore can't be the first character
|
||||
} else if(name == "_") {
|
||||
// A lone underscore isn't a valid tag name
|
||||
return false;
|
||||
} else {
|
||||
return std::all_of(name.begin(), name.end(), [](const char& c)
|
||||
|
|
|
@ -745,7 +745,7 @@ bool luaW_toconfig(lua_State *L, int index, config &cfg)
|
|||
if (!lua_istable(L, -1)) return_misformed();
|
||||
lua_rawgeti(L, -1, 1);
|
||||
char const *m = lua_tostring(L, -1);
|
||||
if (!m || !config::valid_tag(m)) return_misformed();
|
||||
if (!m || !config::valid_tag(m) || m[0] == '_') return_misformed();
|
||||
lua_rawgeti(L, -2, 2);
|
||||
if (!luaW_toconfig(L, -1, cfg.add_child(m)))
|
||||
return_misformed();
|
||||
|
|
Loading…
Add table
Reference in a new issue