Error With "gui.get_text"? (SOLVED)


#1

Hi,

Trying to get a button’s text, I do below but it has error?:

for index = 0, 64 do
	character = gui.get_text( string.format("Char%d", index) )
end

ERROR:SCRIPT: data/gui_script/Screen-9-NewHighScore-GUI-Script.gui_script:182: bad argument #1 to ‘get_text’ (userdata expected, got string)
stack traceback:
[C]: in function ‘get_text’
data/gui_script/Screen-9-NewHighScore-GUI-Script.gui_script:182: in function <data/gui_script/Screen-9-NewHighScore-GUI-Script.gui_script:79>

Any ideas?, thanks!

Jesse


#2

Have you read the documentation for gui.get_text()?
It accepts a gui node as input, not a string.

You get a gui node using gui.get_node(string)

I really urge you to read the documentation, it will help you code faster :slight_smile:


#3

That worked, thank you…