Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | protofan |
Currently I try to add values to an empty dictionary to use data later. After I use this code
while counter < ammount:
var per_name = nameslist[randi() % nameslist.size()]
var surname = surnameslist[randi() % surnameslist.size()]
var age = int(rand_range(20,40))
list[counter] = counter
list[counter].age = age
list[counter].name = per_name
list[counter].surname = surname
counter += 1
print(list)
It sends back error "Invalid set index ‘age’(on base:String) with value type of ‘String’ "
In this case list is the dictionary I am using.
What is causing the error? How can I fix it?