:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Mrpaolosarino

If I try to add these lines:

var no_tab = get_node("TabContainer/Practice /TabContainer2").get_tab_count()
var tab_control = get_node("TabContainer/Practice /TabContainer2")
for q in no_tab :
	var w = tab_control.get_tab_control(q)
	var e = w.get_children()
	for g in e:
		var y = g.get_node("Text_movable").get_text()
		Practice[q] = {w:{g:y}}

This will print out the following format:


What I intended to print is:


Something in that format. I want to illiterate the “g:y” and don’t want to let it replace the current illiteration. Because what happens is every illiteration of “g:y” The existing value is changed by newer ones which is normal but what I want is to create another key of “g:y” , anyone???

I think it is something like adding it to dictionary etc. But on the back of my mind, I cant think of the code.

:bust_in_silhouette: Reply From: exuin

What you seem to want to print out it is an array, not a dictionary. If you want a dictionary you’ll need a unique key for each {g:y} pair.

Yes and the overriding var is still a problem.
I don’t know why it doesn’t work I do a Practice[q][comment0-w] = {g:y}
I try to add the {g:y} so that it doesn’t replace but it says :

Invalid get index '0' (on base: 'Dictionary').

Mrpaolosarino | 2021-04-12 02:47

w is a Control node though

exuin | 2021-04-12 03:38