using varible in dictionary name

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Squatnet
:warning: Old Version Published before Godot 3 was released.

Is it possible to do something like

func set_cargo(type, amt, val):
	dict.cargo.contents.[type].amount = amt
    dict.cargo.contents.[type].value = val
:bust_in_silhouette: Reply From: Squatnet

so i went with

dict.cargo.contents[type] = {"amount":amt,"value":val}

but this could be an issue if i want to store larger numbers of keys. If there is a better way please do let me know