Buttons Named: Char0-Char64 - Modify Buttons In For Statement In Code? (SOLVED)


#1

Hi,

A bit stuck…

I am working on a new high score name input screen now.
Screen will have 65 GUI buttons with each character on each button.

The buttons are named Char0 through Char64.
How can I modify the buttons in a for statement in code?
Rather than have 65 lines of code, I wish to have simple for statement where each button is modified.

Let us know, thanks!

Jesse


#2

Something like this should work:

for n = 0, 64 do
    gui.set_text(gui.get_node(string.format("Char%d", n), "your text")
end

#3

Worked, thanks!