mirror of
https://github.com/godotengine/godot.git
synced 2026-01-05 06:11:29 +03:00
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:
@@ -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)
|
||||
@@ -0,0 +1,2 @@
|
||||
GDTEST_OK
|
||||
{2:4, a:1, b:2, with spaces:3}
|
||||
Reference in New Issue
Block a user