What is wrong with this function? Not writing properly to dictionary.

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By nationality
func compile_action_keyphrases(actions : Array):
	Global.debug.message("Reiterating compiling: ")
	for action in actions:
		Global.debug.message("Started compiling " + action.name + ": ")
		for keyphrase in action.keyphrases:
			Global.debug.message("Keyphrase " + String(keyphrase) + ": ")
			var splitCommand = keyphrase.rsplit(" ")# as Array
			Global.debug.message("Adding " + String(splitCommand) + " for " + action.name + ". ")
			actionDict[splitCommand] = action
			for keyword in keyphrase:
				add_definition_to_maindict(keyword, action)

Everything works as expected until the actionDict[splitCommand] = action line, according to the debug message system I’ve made.
For some reason, the actionDict remains empty, and add_definition_to_maindict never fires.
keyphrase should be a string from a PoolStringArray
I don’t get any debug messages from Godot explaining why.

:bust_in_silhouette: Reply From: nationality

I’ve solved this myself, I needed to change var splitCommand = keyphrase.rsplit(" ") to splitCommand = Array(keyphrase.rsplit(" ")). This is almost certainly a bug with the engine.

If this is a bug, please report it on the Godot engine issue tracker.

Ertain | 2019-05-06 23:26