Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | del | |
Old Version | Published before Godot 3 was released. |
Hi!
So, i have an array for a scoreboard, which holds a number of arrays for rank, name and score values and i want to print them into labels on a grid container with a for loop.
I’ve tried something like this:
for entry in board:
var rank = Label.new()
var score = Label.new()
var name = Label.new()
rank.set_text(str(entry[0]))
score.set_text(str(entry[1]))
name.set_text(str(entry[2]))
But i always get an ‘Invalid get index ‘1’ (on base: ‘Array’).’ message. Index[0] works fine, but everything above it not.
I’ve also tried “for i in range(0, entry.size())” in a new for loop, but i still get the same error.
To just print the strings i could do
for i in entry: var lable = Label.new() table.add_child(label) lable.set_text(str(i))
But i want to access the indices.