GDScript: Allow string keys on Lua-style dictionaries
Which is useful when the key isn't a valid identifier, such as keys with spaces or numeric keys.
This commit is contained in:
@ -440,7 +440,7 @@ GDScriptCodeGenerator::Address GDScriptCompiler::_parse_expression(CodeGen &code
|
||||
break;
|
||||
case GDScriptParser::DictionaryNode::LUA_TABLE:
|
||||
// Lua-style: key is an identifier interpreted as StringName.
|
||||
StringName key = static_cast<const GDScriptParser::IdentifierNode *>(dn->elements[i].key)->name;
|
||||
StringName key = dn->elements[i].key->reduced_value.operator StringName();
|
||||
element = codegen.add_constant(key);
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user