I dont know what the heck is going on.
I have scene.. idk how to explain it, but here is the thing that i want to achieve:
Return array of files.
I have data. Data is structured as dictionary. Keys are strings and value is array. Array consists of files and directories. Files are strings, while directories are dictionaries with directory as key and value as array of files and dirs.
So atm i have set up so that when i click in the UI a directory, it triggers function:
func on_dir_label_button_down(dir_name):
print("Button pressed: ", dir_name)
var lol = file_ops.get_files_from_tree(dir_name,file_ops.current_tree_dic)
print("retunr: ", lol)
pass
file_ops = linked instance in the scene tree
The function:
func get_files_from_tree(dir_key, data):
if data is Dictionary:
var key_v = data.keys()[0]
if key_v == dir_key:
var sorted = get_files_from_arr(data[dir_key])
return sorted
else:
get_files_from_tree(dir_key,data[key_v])
else:
for f in data:
if f is Dictionary:
get_files_from_tree(dir_key,f)
pass
Is recursive.
So this is what i got, the folder i parse looks like this.
I press guru button/directory to get files.
The function break correctly returned the files:
But the break at the button press function call where it should return the values return nulls
Why?