var GM_commands = {}
func _ready():
var gamecode = "ABC"
var command = "start_game"
GM_commands[gamecode]=[] #so that the dict {"ABC":[]} exists
GM_commands[gamecode].append(command)
The last line gives me the error “Invalid get index 'append' (on base: 'array')” which I don’t understand.
var GM_commands = {}
func _ready():
var gamecode = "ABC"
var command = "start_game"
GM_commands.gamecode=[] #so that the dict {"ABC":[]} exists
GM_commands.gamecode.append(command)
print(GM_commands)
In Godot, you can also access dictionary keys that way
I restarted the server, and now it works without giving me an error message, so I have no idea what that error was about, sorry. Thanks for checking it out for me.