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:
George Marques 2021-09-15 09:56:24 -03:00
parent 32f8f74d83
commit 5d31ce4b16
No known key found for this signature in database
GPG key ID: 046BD46A3201E43D
10 changed files with 48 additions and 4 deletions

View file

@ -0,0 +1,9 @@
func test():
var lua_dict = {
a = 1,
"b" = 2, # Using strings are allowed too.
"with spaces" = 3, # Especially useful when key has spaces...
"2" = 4, # ... or invalid identifiers.
}
print(lua_dict)